Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Unified Diff: dart/sdk/lib/_internal/compiler/js_lib/js_helper.dart

Issue 734323003: Use Object.create instead of a tmp-function. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dart/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/sdk/lib/_internal/compiler/js_lib/js_helper.dart
diff --git a/dart/sdk/lib/_internal/compiler/js_lib/js_helper.dart b/dart/sdk/lib/_internal/compiler/js_lib/js_helper.dart
index c6fd99a3343874b392017126c23958e90c0ebb30..2de11198c0b566024fabc4e4135d624ee2fd2d9a 100644
--- a/dart/sdk/lib/_internal/compiler/js_lib/js_helper.dart
+++ b/dart/sdk/lib/_internal/compiler/js_lib/js_helper.dart
@@ -1970,7 +1970,6 @@ abstract class Closure implements Function {
// So we only use the new instance to access the constructor property and
// use Object.create to create the desired prototype.
var prototype = isStatic
- // TODO(ahe): Safe to use Object.create?
? JS('TearOffClosure', 'Object.create(#.constructor.prototype)',
new TearOffClosure())
: JS('BoundClosure', 'Object.create(#.constructor.prototype)',
@@ -1986,7 +1985,8 @@ abstract class Closure implements Function {
'"this.\$initialize(a,b,c,d);"+#)',
functionCounter++);
- // TODO(ahe): Is it necessary to set the constructor property?
+ // It is necessary to set the constructor property, otherwise it will be
+ // "Object".
JS('', '#.constructor = #', prototype, constructor);
JS('', '#.prototype = #', constructor, prototype);
« no previous file with comments | « dart/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698