Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/resolution/members.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart |
| index 586d28f590022f78ad7b015f64dabd343bb84d13..ff0bd625d740155215f16b63e2f270c39e1419f3 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart |
| @@ -477,11 +477,12 @@ class ResolverTask extends CompilerTask { |
| compiler.reportError(element, MessageKind.CONST_WITHOUT_INITIALIZER); |
| } |
| + visitor.addPostProcessAction(element, () { |
|
karlklose
2013/10/02 11:08:55
Add a TODO to check if we need a constant.
Johnni Winther
2013/10/02 12:39:33
Reverted this change. The constant is only needed
|
| + compiler.constantHandler.compileVariable( |
| + element, isConst: element.modifiers.isConst()); |
| + }); |
| + |
| if (Elements.isStaticOrTopLevelField(element)) { |
| - visitor.addPostProcessAction(element, () { |
| - compiler.constantHandler.compileVariable( |
| - element, isConst: element.modifiers.isConst()); |
| - }); |
| if (tree.asSendSet() != null) { |
| if (!element.modifiers.isConst()) { |
| // TODO(johnniwinther): Determine the const-ness eagerly to avoid |
| @@ -2441,7 +2442,9 @@ class ResolverVisitor extends MappingVisitor<Element> { |
| // type literal. |
| mapping.setType(node, compiler.typeClass.computeType(compiler)); |
| world.registerTypeLiteral(target, mapping); |
| - analyzeConstant(node); |
| + |
| + // Don't try to make constants of calls to type literals. |
| + analyzeConstant(node, isConst: !node.isCall); |
| } |
| } |
| @@ -2892,11 +2895,10 @@ class ResolverVisitor extends MappingVisitor<Element> { |
| return null; |
| } |
| - void analyzeConstant(Node node) { |
| + void analyzeConstant(Node node, {bool isConst: true}) { |
| addPostProcessAction(enclosingElement, () { |
| - mapping.setConstant(node, |
| - compiler.constantHandler.compileNodeWithDefinitions( |
| - node, mapping, isConst: true)); |
| + compiler.constantHandler.compileNodeWithDefinitions( |
| + node, mapping, isConst: isConst); |
| }); |
| } |