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

Side by Side Diff: frog/value.dart

Issue 9151015: addressing 3 previous review comments (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebased Created 8 years, 11 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
« no previous file with comments | « frog/tokenizer.dart ('k') | tests/language/language.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 * Represents a meta-value for code generation. 6 * Represents a meta-value for code generation.
7 */ 7 */
8 class Value { 8 class Value {
9 Type _type; 9 Type _type;
10 10
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 574
575 575
576 // TODO(jimhug): rename to PrimitiveValue and refactor further 576 // TODO(jimhug): rename to PrimitiveValue and refactor further
577 class EvaluatedValue extends Value implements Hashable { 577 class EvaluatedValue extends Value implements Hashable {
578 /** Is this value treated as const by dart language? */ 578 /** Is this value treated as const by dart language? */
579 bool isConst; 579 bool isConst;
580 580
581 EvaluatedValue(this.isConst, Type type, SourceSpan span): 581 EvaluatedValue(this.isConst, Type type, SourceSpan span):
582 super(type, '@@@', span, false); 582 super(type, '@@@', span, false);
583 583
584 String get code() => '@@@'; 584 String get code() {
585 world.internalError('Should not be getting code from raw EvaluatedValue',
586 span);
587 }
588
585 589
586 EvaluatedValue get constValue() => this; 590 EvaluatedValue get constValue() => this;
587 591
588 // TODO(jimhug): Using computed code here without caching is major fear. 592 // TODO(jimhug): Using computed code here without caching is major fear.
589 int hashCode() => code.hashCode(); 593 int hashCode() => code.hashCode();
590 594
591 bool operator ==(var other) { 595 bool operator ==(var other) {
592 return other is EvaluatedValue && other.type == this.type && 596 return other is EvaluatedValue && other.type == this.type &&
593 other.code == this.code; 597 other.code == this.code;
594 } 598 }
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 934
931 class ListValue extends EvaluatedValue { 935 class ListValue extends EvaluatedValue {
932 List<Value> values; 936 List<Value> values;
933 937
934 ListValue(this.values, bool isConst, Type type, SourceSpan span): 938 ListValue(this.values, bool isConst, Type type, SourceSpan span):
935 super(isConst, type, span); 939 super(isConst, type, span);
936 940
937 String get code() { 941 String get code() {
938 final buf = new StringBuffer(); 942 final buf = new StringBuffer();
939 buf.add('['); 943 buf.add('[');
940 for (var i=0; i < values.length; i++) { 944 for (var i = 0; i < values.length; i++) {
941 if (i > 0) buf.add(', '); 945 if (i > 0) buf.add(', ');
942 buf.add(values[i].code); 946 buf.add(values[i].code);
943 } 947 }
944 buf.add(']'); 948 buf.add(']');
945 var listCode = buf.toString(); 949 var listCode = buf.toString();
946 950
947 if (!isConst) return listCode; 951 if (!isConst) return listCode;
948 952
949 var v = new Value(world.listType, listCode, span); 953 var v = new Value(world.listType, listCode, span);
950 final immutableListCtor = world.immutableListType.getConstructor('from'); 954 final immutableListCtor = world.immutableListType.getConstructor('from');
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 } 1225 }
1222 1226
1223 _ensureCode(); 1227 _ensureCode();
1224 return null; 1228 return null;
1225 } 1229 }
1226 } 1230 }
1227 1231
1228 String _escapeForComment(String text) { 1232 String _escapeForComment(String text) {
1229 return text.replaceAll('/*', '/ *').replaceAll('*/', '* /'); 1233 return text.replaceAll('/*', '/ *').replaceAll('*/', '* /');
1230 } 1234 }
OLDNEW
« no previous file with comments | « frog/tokenizer.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698