| 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, _js_helper; | 5 var dart, _js_helper; |
| 6 (function (dart) { | 6 (function (dart) { |
| 7 'use strict'; | 7 'use strict'; |
| 8 | 8 |
| 9 var defineProperty = Object.defineProperty; | 9 var defineProperty = Object.defineProperty; |
| 10 var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; | 10 var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 dart.assert = assert; | 274 dart.assert = assert; |
| 275 | 275 |
| 276 function throw_(obj) { throw obj; } | 276 function throw_(obj) { throw obj; } |
| 277 dart.throw_ = throw_; | 277 dart.throw_ = throw_; |
| 278 | 278 |
| 279 /** | 279 /** |
| 280 * Given a class and an initializer method name, creates a constructor | 280 * Given a class and an initializer method name, creates a constructor |
| 281 * function with the same name. For example `new SomeClass.name(args)`. | 281 * function with the same name. For example `new SomeClass.name(args)`. |
| 282 */ | 282 */ |
| 283 function defineNamedConstructor(clazz, name) { | 283 function defineNamedConstructor(clazz, name) { |
| 284 var shortName = name.startsWith('::') ? name.substring(2) : name; | |
| 285 var proto = clazz.prototype; | 284 var proto = clazz.prototype; |
| 286 var initMethod = proto[clazz.name + '$' + shortName]; | 285 var initMethod = proto[name]; |
| 287 var ctor = function() { return initMethod.apply(this, arguments); } | 286 var ctor = function() { return initMethod.apply(this, arguments); } |
| 288 ctor.prototype = proto; | 287 ctor.prototype = proto; |
| 289 clazz[name] = ctor; | 288 clazz[name] = ctor; |
| 290 } | 289 } |
| 291 dart.defineNamedConstructor = defineNamedConstructor; | 290 dart.defineNamedConstructor = defineNamedConstructor; |
| 292 | 291 |
| 293 function stackTrace(exception) { | 292 function stackTrace(exception) { |
| 294 throw new core.UnimplementedError(); | 293 throw new core.UnimplementedError(); |
| 295 } | 294 } |
| 296 dart.stackTrace = stackTrace; | 295 dart.stackTrace = stackTrace; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 // of some sort, assuming we keep around `dynamic` at runtime. | 339 // of some sort, assuming we keep around `dynamic` at runtime. |
| 341 dart.dynamic = Object.create(null); | 340 dart.dynamic = Object.create(null); |
| 342 | 341 |
| 343 dart.JsSymbol = Symbol; | 342 dart.JsSymbol = Symbol; |
| 344 | 343 |
| 345 // TODO(jmesserly): hack to bootstrap the SDK | 344 // TODO(jmesserly): hack to bootstrap the SDK |
| 346 _js_helper = _js_helper || {}; | 345 _js_helper = _js_helper || {}; |
| 347 _js_helper.checkNum = notNull; | 346 _js_helper.checkNum = notNull; |
| 348 | 347 |
| 349 })(dart || (dart = {})); | 348 })(dart || (dart = {})); |
| OLD | NEW |