Chromium Code Reviews| Index: frog/leg/compile_time_constants.dart |
| diff --git a/frog/leg/compile_time_constants.dart b/frog/leg/compile_time_constants.dart |
| index 46a5e2a1a2a4fc2ff49414faebc4be424a67bd1b..9567dcb1bcc03daad2b7e981f2a7ba68889e6666 100644 |
| --- a/frog/leg/compile_time_constants.dart |
| +++ b/frog/leg/compile_time_constants.dart |
| @@ -509,31 +509,35 @@ class ConstantHandler extends CompilerTask { |
| Constant compileVariableWithDefinitions(VariableElement element, |
| TreeElements definitions) { |
| - return measure(() { |
| - Node node = element.parseNode(compiler); |
| - assert(node !== null); |
| - SendSet assignment = node.asSendSet(); |
| - var value; |
| - if (assignment === null) { |
| - // No initial value. |
| - value = new NullConstant(); |
| - } else { |
| - if (pendingVariables.contains(element)) { |
| - MessageKind kind = MessageKind.CYCLIC_COMPILE_TIME_CONSTANTS; |
| - compiler.reportError(node, |
| - new CompileTimeConstantError(kind, const [])); |
| - } |
| - pendingVariables.add(element); |
|
ngeoffray
2012/03/20 08:26:07
Why is this one not measuring anymore? Even if it
floitsch
2012/03/21 07:14:24
done.
Wanted to do the same for compileVariable, b
|
| - Node right = assignment.arguments.head; |
| - CompileTimeConstantEvaluator evaluator = |
| - new CompileTimeConstantEvaluator(this, definitions, compiler); |
| - value = evaluator.evaluate(right); |
| + Node node = element.parseNode(compiler); |
| + if (pendingVariables.contains(element)) { |
| + MessageKind kind = MessageKind.CYCLIC_COMPILE_TIME_CONSTANTS; |
| + compiler.reportError(node, |
| + new CompileTimeConstantError(kind, const [])); |
|
ahe
2012/03/20 08:28:40
While trying to make our errors non-fatal, I notic
ngeoffray
2012/03/20 08:30:52
IMO, I don't see any trouble in returning somethin
floitsch
2012/03/21 07:14:24
It could lead to another cryptic error right after
ngeoffray
2012/03/21 07:41:11
Considering what Peter is trying to achieve (makin
ahe
2012/03/21 10:13:37
Which is definitely an improvement over the same e
|
| + } |
| + pendingVariables.add(element); |
| - pendingVariables.remove(element); |
| - } |
| - initialVariableValues[element] = value; |
| - return value; |
| + SendSet assignment = node.asSendSet(); |
| + Constant value; |
| + if (assignment === null) { |
| + // No initial value. |
| + value = new NullConstant(); |
| + } else { |
| + Node right = assignment.arguments.head; |
| + value = compileNodeWithDefinitions(right, definitions); |
| + } |
| + initialVariableValues[element] = value; |
| + pendingVariables.remove(element); |
| + return value; |
| + } |
| + |
| + Constant compileNodeWithDefinitions(Node node, TreeElements definitions) { |
| + return measure(() { |
| + assert(node !== null); |
| + CompileTimeConstantEvaluator evaluator = |
| + new CompileTimeConstantEvaluator(this, definitions, compiler); |
| + return evaluator.evaluate(node); |
| }); |
| } |