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

Side by Side Diff: frog/value.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 5
6 interface CallingContext { 6 interface CallingContext {
7 MemberSet findMembers(String name); 7 MemberSet findMembers(String name);
8 CounterLog get counters(); 8 CounterLog get counters();
9 Library get library(); 9 Library get library();
10 bool get isStatic(); 10 bool get isStatic();
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 final bool isConst; 897 final bool isConst;
898 898
899 EvaluatedValue(this.isConst, Type type, SourceSpan span): 899 EvaluatedValue(this.isConst, Type type, SourceSpan span):
900 super(type, '@@@', span); 900 super(type, '@@@', span);
901 901
902 String get code() { 902 String get code() {
903 world.internalError('Should not be getting code from raw EvaluatedValue', 903 world.internalError('Should not be getting code from raw EvaluatedValue',
904 span); 904 span);
905 } 905 }
906 906
907 get actualValue() {
908 world.internalError('Should not be getting actual value '
909 'from raw EvaluatedValue', span);
910 }
911
907 bool get needsTemp() => false; 912 bool get needsTemp() => false;
908 913
909 EvaluatedValue get constValue() => this; 914 EvaluatedValue get constValue() => this;
910 915
911 // TODO(jimhug): Using computed code here without caching is major fear. 916 // TODO(jimhug): Using computed code here without caching is major fear.
912 int hashCode() => code.hashCode(); 917 int hashCode() => code.hashCode();
913 918
914 bool operator ==(var other) { 919 bool operator ==(var other) {
915 return other is EvaluatedValue && other.type == this.type && 920 return other is EvaluatedValue && other.type == this.type &&
916 other.code == this.code; 921 other.code == this.code;
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 } 1246 }
1242 } 1247 }
1243 break; 1248 break;
1244 } 1249 }
1245 } 1250 }
1246 buf.add('"'); 1251 buf.add('"');
1247 return buf.toString(); 1252 return buf.toString();
1248 } 1253 }
1249 } 1254 }
1250 1255
1251
1252 class ListValue extends EvaluatedValue { 1256 class ListValue extends EvaluatedValue {
1253 final List<Value> values; 1257 final List<Value> values;
1254 1258
1255 ListValue(this.values, bool isConst, Type type, SourceSpan span): 1259 ListValue(this.values, bool isConst, Type type, SourceSpan span):
1256 super(isConst, type, span); 1260 super(isConst, type, span);
1257 1261
1258 String get code() { 1262 String get code() {
1259 final buf = new StringBuffer(); 1263 final buf = new StringBuffer();
1260 buf.add('['); 1264 buf.add('[');
1261 for (var i = 0; i < values.length; i++) { 1265 for (var i = 0; i < values.length; i++) {
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 } 1637 }
1634 return super.unop(kind, context, node); 1638 return super.unop(kind, context, node);
1635 } 1639 }
1636 Value binop(int kind, var other, CallingContext context, var node) { 1640 Value binop(int kind, var other, CallingContext context, var node) {
1637 if (value != null) { 1641 if (value != null) {
1638 return replaceValue(value.binop(kind, _unwrap(other), context, node)); 1642 return replaceValue(value.binop(kind, _unwrap(other), context, node));
1639 } 1643 }
1640 return super.binop(kind, other, context, node); 1644 return super.binop(kind, other, context, node);
1641 } 1645 }
1642 } 1646 }
OLDNEW
« frog/gen.dart ('K') | « frog/minfrog ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698