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

Unified Diff: frog/analyze.dart

Issue 9700016: Allow interpolated strings and adjacent strings to be compile-time constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/gen.dart » ('j') | frog/gen.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/analyze.dart
diff --git a/frog/analyze.dart b/frog/analyze.dart
index 04cba5add87d28dffc2576d9de63192813de5d61..0ff13cca55a10abd15f61b849a1642297dc30bb3 100644
--- a/frog/analyze.dart
+++ b/frog/analyze.dart
@@ -775,25 +775,19 @@ class MethodAnalyzer implements TreeVisitor {
}
Value visitStringConcatExpression(StringConcatExpression node) {
- node.strings.forEach(visitValue);
- return _frame._makeValue(world.stringType, node);
+ bool isConst = true;
+ node.strings.forEach((each) {
+ if (!visitValue(each).isConst) isConst = false;
+ });
+ return new PureStaticValue(world.stringType, node.span, isConst);
}
Value visitStringInterpExpression(StringInterpExpression node) {
- node.pieces.forEach(visitValue);
- return _frame._makeValue(world.stringType, node);
-
- // TODO(jimhug): Do we need this more elaborate analysis?
- /*
- var ret = Value.fromString('', node.span);
-
- for (var item in node.pieces) {
- var val = visitValue(item);
- var sval = val.invoke(_frame, 'toString', item, Arguments.EMPTY);
- ret = ret.binop(TokenKind.ADD, sval, _frame, item);
- }
- return _frame._makeValue(world.stringType, node); //???ret;
- */
+ bool isConst = true;
+ node.pieces.forEach((each) {
+ if (!visitValue(each).isConst) isConst = false;
+ });
+ return new PureStaticValue(world.stringType, node.span, isConst);
}
}
« no previous file with comments | « no previous file | frog/gen.dart » ('j') | frog/gen.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698