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

Unified Diff: lib/src/codegen/js_codegen.dart

Issue 1347453002: fix a few more codegen issues: (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: run the tests too Created 5 years, 3 months 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
Index: lib/src/codegen/js_codegen.dart
diff --git a/lib/src/codegen/js_codegen.dart b/lib/src/codegen/js_codegen.dart
index 048bb5c8508f6633a0b5a295e4f98eedc4740c58..b1877e9a41d4aea173263529e22ab6025b2bd684 100644
--- a/lib/src/codegen/js_codegen.dart
+++ b/lib/src/codegen/js_codegen.dart
@@ -226,11 +226,13 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ClosureAnnotator {
module
]);
- var jsBin = compiler.options.runnerOptions.v8Binary;
-
- String scriptTag = null;
- if (library.library.scriptTag != null) scriptTag = '/usr/bin/env $jsBin';
- return new JS.Program(<JS.Statement>[moduleDef], scriptTag: scriptTag);
+ // TODO(jmesserly): scriptTag support.
+ // Enable this if we know we're targetting command line environment?
+ // It doesn't work in browser.
+ // var jsBin = compiler.options.runnerOptions.v8Binary;
+ // String scriptTag = null;
+ // if (library.library.scriptTag != null) scriptTag = '/usr/bin/env $jsBin';
+ return new JS.Program(<JS.Statement>[moduleDef]);
}
void _emitModuleItem(AstNode node) {
@@ -3191,6 +3193,10 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ClosureAnnotator {
name = 'set';
} else if (name == '-' && unary) {
name = 'unary-';
+ } else if (name == 'constructor' || name == 'prototype') {
+ // This uses an illegal (in Dart) character for a member, avoiding the
+ // conflict. We could use practically any character for this.
+ name = '+$name';
}
// Dart "extension" methods. Used for JS Array, Boolean, Number, String.

Powered by Google App Engine
This is Rietveld 408576698