| Index: lib/src/codegen/js_codegen.dart
|
| diff --git a/lib/src/codegen/js_codegen.dart b/lib/src/codegen/js_codegen.dart
|
| index 2945606b06a61249cd4b4e7c6db9a9710e7d6b50..e27539e7c2092ec9ec3e053b6c59f09d9ff1d4ff 100644
|
| --- a/lib/src/codegen/js_codegen.dart
|
| +++ b/lib/src/codegen/js_codegen.dart
|
| @@ -711,10 +711,13 @@ 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)) &&
|
| + // TODO(vsm): This is a workaround until this is fixed:
|
| + // https://github.com/dart-lang/dev_compiler/issues/131
|
| + if ((/*field.isConst || */ _isFieldInitConstant(field)) &&
|
| !JS.invalidStaticFieldName(fieldName)) {
|
| var init = _visit(field.initializer);
|
| if (init == null) init = new JS.LiteralNull();
|
| + fieldName = _emitMemberName(fieldName, isStatic: true);
|
| body.add(js.statement('#.# = #;', [name, fieldName, init]));
|
| } else {
|
| lazyStatics.add(field);
|
| @@ -2056,15 +2059,6 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
|
| ]);
|
| }
|
|
|
| - if (_isJSBuiltinType(type)) {
|
| - // static call pattern for builtins.
|
| - return js.call('#.#(#, #)', [
|
| - _emitTypeName(type),
|
| - memberName,
|
| - _visit(target),
|
| - _visitList(args)
|
| - ]);
|
| - }
|
| // Generic dispatch to a statically known method.
|
| return js.call('#.#(#)', [_visit(target), memberName, _visitList(args)]);
|
| }
|
| @@ -2381,8 +2375,16 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
|
| // side effect free. We should make the check more general, as things like
|
| // list/map literals/regexp are also side effect free and fairly common
|
| // to use as field initializers.
|
| - bool _isFieldInitConstant(VariableDeclaration field) =>
|
| - field.initializer == null || _computeConstant(field).isValid;
|
| + // TODO(vsm): Restore once this is fixed:
|
| + // https://github.com/dart-lang/dev_compiler/issues/131
|
| + bool _isFieldInitConstant(VariableDeclaration field) {
|
| + var initializer = field.initializer;
|
| + if (initializer == null) return true;
|
| + if (field.isConst || _computeConstant(field).isValid) {
|
| + return initializer is Literal && initializer is! TypedLiteral;
|
| + }
|
| + return false;
|
| + }
|
|
|
| EvaluationResult _computeConstant(VariableDeclaration field) {
|
| // If the constant is already computed by ConstantEvaluator, just return it.
|
|
|