Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 9d2f597

Browse files
author
John Messerly
committed
use js_ast instead of strings to generate JS
fixes #61 [email protected], [email protected] Review URL: https://codereview.chromium.org/949383003
1 parent 8e65be8 commit 9d2f597

File tree

27 files changed

+6008
-4213
lines changed

27 files changed

+6008
-4213
lines changed

lib/runtime/dart_runtime.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ var dart;
3838
}
3939
dart.dload = dload;
4040

41+
// TODO(jmesserly): this should call noSuchMethod, not throw.
4142
function throwNoSuchMethod(obj, name, args, opt_func) {
4243
if (obj === void 0) obj = opt_func;
4344
throw new core.NoSuchMethodError(obj, name, args);
@@ -266,6 +267,9 @@ var dart;
266267
}
267268
dart.assert = assert;
268269

270+
function throw_(obj) { throw obj; }
271+
dart.throw_ = throw_;
272+
269273
/**
270274
* Given a class and an initializer method name, creates a constructor
271275
* function with the same name. For example `new SomeClass.name(args)`.
@@ -341,7 +345,9 @@ var dart;
341345
// Get the class name for this instance.
342346
var name = this.constructor.name;
343347
// Call the default constructor.
344-
var result = this[name].apply(this, arguments);
348+
var init = this[name];
349+
var result = void 0;
350+
if (init) result = init.apply(this, arguments);
345351
return result === void 0 ? this : result;
346352
};
347353
// The initializer for dart.Object

0 commit comments

Comments
 (0)