Index: lib/runtime/dart_core.js |
diff --git a/lib/runtime/dart_core.js b/lib/runtime/dart_core.js |
index 12084b86f260c5762cd0055f746344d2a353605a..ce3402050cc386fcfc26815e220f2f968859896b 100644 |
--- a/lib/runtime/dart_core.js |
+++ b/lib/runtime/dart_core.js |
@@ -2,35 +2,49 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
-var dart_core; |
-(function (dart_core) { |
- var Object = (function () { |
- var constructor = function Object() {}; |
+var core; |
+(function (core) { |
+ 'use strict'; |
- constructor.prototype.toString = function toString() { |
- return 'Instance of ' + this.constructor.name; |
- }; |
- |
- constructor.prototype.noSuchMethod = function noSuchMethod(invocation) { |
- // TODO: add arguments when Invocation is defined |
- throw new NoSuchMethodError(); |
- }; |
- |
- // TODO: implement == |
- |
- // TODO: implement hashCode |
- |
- // TODO: implement runtimeType |
+ // TODO(jmesserly): for now this is copy+paste from dart/core.js |
+ class Object { |
+ constructor() { |
+ var name = this.constructor.name; |
+ var init = this[name]; |
+ var result = void 0; |
+ if (init) |
+ result = init.apply(this, arguments); |
+ return result === void 0 ? this : result; |
+ } |
+ ['=='](other) { |
+ return identical(this, other); |
+ } |
+ get hashCode() { |
+ return _js_helper.Primitives.objectHashCode(this); |
+ } |
+ toString() { |
+ return _js_helper.Primitives.objectToString(this); |
+ } |
+ noSuchMethod(invocation) { |
+ throw new NoSuchMethodError(this, invocation.memberName, invocation.positionalArguments, invocation.namedArguments); |
+ } |
+ get runtimeType() { |
+ return _js_helper.getRuntimeType(this); |
+ } |
+ } |
+ core.Object = Object; |
- return constructor; |
- })(); |
- dart_core.Object = Object; |
+ // Function identical: (Object, Object) → bool |
+ function identical(a, b) { |
+ return _js_helper.Primitives.identicalImplementation(a, b); |
+ } |
+ core.identical = identical; |
// Function print: (Object) → void |
function print(obj) { |
console.log(obj.toString()); |
} |
- dart_core.print = print; |
+ core.print = print; |
// Class NoSuchMethodError |
var NoSuchMethodError = (function () { |
@@ -39,7 +53,7 @@ var dart_core; |
} |
return NoSuchMethodError; |
})(); |
- dart_core.NoSuchMethodError = NoSuchMethodError; |
+ core.NoSuchMethodError = NoSuchMethodError; |
// Class UnimplementedError |
var UnimplementedError = (function () { |
@@ -49,5 +63,5 @@ var dart_core; |
} |
return UnimplementedError; |
})(); |
- dart_core.UnimplementedError = UnimplementedError; |
-})(dart_core || (dart_core = {})); |
+ core.UnimplementedError = UnimplementedError; |
+})(core || (core = {})); |