Index: lib/runtime/dart_sdk.js |
diff --git a/lib/runtime/dart_sdk.js b/lib/runtime/dart_sdk.js |
index 89aa138130ea3f845aca09352acc821947d33dfd..11d610f85968b54480a5b6964bde512166a3091c 100644 |
--- a/lib/runtime/dart_sdk.js |
+++ b/lib/runtime/dart_sdk.js |
@@ -837,8 +837,20 @@ dart_library.library('dart_sdk', null, /* Imports */[ |
dart.defineNamedConstructor = function(clazz, name) { |
let proto = clazz.prototype; |
let initMethod = proto[name]; |
- let ctor = function() { |
- return initMethod.apply(this, arguments); |
+ let ctor = function(...args) { |
+ initMethod.apply(this, args); |
+ }; |
+ ctor.prototype = proto; |
+ dart.defineProperty(clazz, name, {value: ctor, configurable: true}); |
+ }; |
+ dart.defineNamedConstructorCallable = function(clazz, name) { |
+ let proto = clazz.prototype; |
+ let initMethod = proto[name]; |
+ let ctor = function(...args) { |
+ let call = this.call.bind(this); |
+ call.__proto__ = this.__proto__; |
+ initMethod.apply(call, args); |
+ return call; |
}; |
ctor.prototype = proto; |
dart.defineProperty(clazz, name, {value: ctor, configurable: true}); |
@@ -934,6 +946,12 @@ dart_library.library('dart_sdk', null, /* Imports */[ |
derived.prototype[dart._extensionType] = derived; |
derived.prototype.__proto__ = base.prototype; |
}; |
+ dart.callableClass = function(callableCtor, classExpr) { |
+ callableCtor.prototype = classExpr.prototype; |
+ callableCtor.prototype.constructor = callableCtor; |
+ callableCtor.__proto__ = classExpr.__proto__; |
+ return callableCtor; |
+ }; |
dart.throwCastError = function(object, actual, type) { |
dart.throw(new _js_helper.CastErrorImplementation(object, dart.typeName(actual), dart.typeName(type))); |
}; |