summaryrefslogtreecommitdiff
path: root/js/src/Ice/Object.js
blob: b804349c55759c302b5c66597fa1fc416dc85827 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// **********************************************************************
//
// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

//
// Ice.Object
//
// Using IceObject in this file to avoid collisions with the native Object.
//
const Ice = require("../Ice/ModuleRegistry").Ice;
Ice._ModuleRegistry.require(module,
    [
        "../Ice/Exception",
        "../Ice/FormatType",
        "../Ice/StreamHelpers",
        "../Ice/OptionalFormat"
    ]);

const ids = ["::Ice::Object"];

Ice.Object = class
{
    ice_isA(s, current)
    {
        return this._iceMostDerivedType()._iceIds.indexOf(s) >= 0;
    }

    ice_ping(current)
    {
    }

    ice_ids(current)
    {
        return this._iceMostDerivedType()._iceIds;
    }

    ice_id(current)
    {
        return this._iceMostDerivedType()._iceId;
    }

    toString()
    {
        return "[object " + this.ice_id() + "]";
    }

    //
    // _iceMostDerivedType returns the the most derived Ice generated class. This is
    // necessary because the user might extend Slice generated classes. The user
    // class extensions don't have _iceId, _iceIds, etc static members so the implementation
    // of ice_id and ice_ids would fail trying to access those members of the user
    // defined class. Instead, ice_id, ice_ids and ice_instanceof call _iceMostDerivedType
    // to get the most derived Ice class.
    //
    _iceMostDerivedType()
    {
        return Ice.Object;
    }

    //
    // The default implementation of equals compare references.
    //
    equals(other)
    {
        return this === other;
    }

    static get _iceImplements()
    {
        return [];
    }
};

module.exports.Ice = Ice;