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

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

Issue 1111803005: fix #159, static renames for caller/arguments (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: rebase Created 5 years, 8 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 c533eb4e0fa548cd439354c802d7383e160b3a68..0c9199c7f46c6969dd6918f2c7b413ca89946466 100644
--- a/lib/src/codegen/js_codegen.dart
+++ b/lib/src/codegen/js_codegen.dart
@@ -641,7 +641,8 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
for (FieldDeclaration member in staticFields) {
for (VariableDeclaration field in member.fields.variables) {
var fieldName = field.name.name;
- if (field.isConst || _isFieldInitConstant(field)) {
+ if ((field.isConst || _isFieldInitConstant(field)) &&
+ !JS.invalidStaticFieldName(fieldName)) {
var init = _visit(field.initializer);
if (init == null) init = new JS.LiteralNull();
body.add(js.statement('#.# = #;', [name, fieldName, init]));
@@ -2363,18 +2364,8 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
JS.Expression _emitMemberName(String name,
{DartType type, bool unary: false, bool isStatic: false}) {
- // Static methods skip most of the rename steps.
- if (isStatic) {
- if (JS.invalidStaticMethodName(name)) {
- // Choose an string name. Use an invalid identifier so it won't conflict
- // with any valid member names.
- // TODO(jmesserly): this works around the problem, but I'm pretty sure we
- // don't need it, as static methods seemed to work. The only concrete
- // issue we saw was in the defineNamedConstructor helper function.
- name = '$name*';
- }
- return _propertyName(name);
- }
+ // Static members skip the rename steps.
+ if (isStatic) return _propertyName(name);
if (name.startsWith('_')) {
return _privateNames.putIfAbsent(

Powered by Google App Engine
This is Rietveld 408576698