| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 var dart_core; | 5 var core; |
| 6 (function (dart_core) { | 6 (function (core) { |
| 7 var Object = (function () { | 7 'use strict'; |
| 8 var constructor = function Object() {}; | |
| 9 | 8 |
| 10 constructor.prototype.toString = function toString() { | 9 // TODO(jmesserly): for now this is copy+paste from dart/core.js |
| 11 return 'Instance of ' + this.constructor.name; | 10 class Object { |
| 12 }; | 11 constructor() { |
| 12 var name = this.constructor.name; |
| 13 var init = this[name]; |
| 14 var result = void 0; |
| 15 if (init) |
| 16 result = init.apply(this, arguments); |
| 17 return result === void 0 ? this : result; |
| 18 } |
| 19 ['=='](other) { |
| 20 return identical(this, other); |
| 21 } |
| 22 get hashCode() { |
| 23 return _js_helper.Primitives.objectHashCode(this); |
| 24 } |
| 25 toString() { |
| 26 return _js_helper.Primitives.objectToString(this); |
| 27 } |
| 28 noSuchMethod(invocation) { |
| 29 throw new NoSuchMethodError(this, invocation.memberName, invocation.positi
onalArguments, invocation.namedArguments); |
| 30 } |
| 31 get runtimeType() { |
| 32 return _js_helper.getRuntimeType(this); |
| 33 } |
| 34 } |
| 35 core.Object = Object; |
| 13 | 36 |
| 14 constructor.prototype.noSuchMethod = function noSuchMethod(invocation) { | 37 // Function identical: (Object, Object) → bool |
| 15 // TODO: add arguments when Invocation is defined | 38 function identical(a, b) { |
| 16 throw new NoSuchMethodError(); | 39 return _js_helper.Primitives.identicalImplementation(a, b); |
| 17 }; | 40 } |
| 18 | 41 core.identical = identical; |
| 19 // TODO: implement == | |
| 20 | |
| 21 // TODO: implement hashCode | |
| 22 | |
| 23 // TODO: implement runtimeType | |
| 24 | |
| 25 return constructor; | |
| 26 })(); | |
| 27 dart_core.Object = Object; | |
| 28 | 42 |
| 29 // Function print: (Object) → void | 43 // Function print: (Object) → void |
| 30 function print(obj) { | 44 function print(obj) { |
| 31 console.log(obj.toString()); | 45 console.log(obj.toString()); |
| 32 } | 46 } |
| 33 dart_core.print = print; | 47 core.print = print; |
| 34 | 48 |
| 35 // Class NoSuchMethodError | 49 // Class NoSuchMethodError |
| 36 var NoSuchMethodError = (function () { | 50 var NoSuchMethodError = (function () { |
| 37 // TODO(vsm): Implement. | 51 // TODO(vsm): Implement. |
| 38 function NoSuchMethodError(f, args) { | 52 function NoSuchMethodError(f, args) { |
| 39 } | 53 } |
| 40 return NoSuchMethodError; | 54 return NoSuchMethodError; |
| 41 })(); | 55 })(); |
| 42 dart_core.NoSuchMethodError = NoSuchMethodError; | 56 core.NoSuchMethodError = NoSuchMethodError; |
| 43 | 57 |
| 44 // Class UnimplementedError | 58 // Class UnimplementedError |
| 45 var UnimplementedError = (function () { | 59 var UnimplementedError = (function () { |
| 46 // TODO(vsm): Implement. | 60 // TODO(vsm): Implement. |
| 47 function UnimplementedError(message) { | 61 function UnimplementedError(message) { |
| 48 this.message = (message != void 0) ? message : null; | 62 this.message = (message != void 0) ? message : null; |
| 49 } | 63 } |
| 50 return UnimplementedError; | 64 return UnimplementedError; |
| 51 })(); | 65 })(); |
| 52 dart_core.UnimplementedError = UnimplementedError; | 66 core.UnimplementedError = UnimplementedError; |
| 53 })(dart_core || (dart_core = {})); | 67 })(core || (core = {})); |
| OLD | NEW |