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

Unified Diff: frog/leg/compile_time_constants.dart

Issue 9703074: Call the compile-time constant handler inside bodies. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status files. Created 8 years, 9 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
« no previous file with comments | « no previous file | frog/leg/ssa/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
});
}
« no previous file with comments | « no previous file | frog/leg/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698