OLD | NEW |
1 // Copyright (c) 2011, 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 * 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 |
11 /** The javascript code to generate this value. */ | 11 /** The javascript code to generate this value. */ |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 | 983 |
984 class MapValue extends EvaluatedValue { | 984 class MapValue extends EvaluatedValue { |
985 List<Value> values; | 985 List<Value> values; |
986 | 986 |
987 MapValue(this.values, bool isConst, Type type, SourceSpan span): | 987 MapValue(this.values, bool isConst, Type type, SourceSpan span): |
988 super(isConst, type, span); | 988 super(isConst, type, span); |
989 | 989 |
990 String get code() { | 990 String get code() { |
991 // Cache? | 991 // Cache? |
992 var items = new ListValue(values, false, world.listType, span); | 992 var items = new ListValue(values, false, world.listType, span); |
993 var tp = world.corelib.topType; | 993 var tp = world.coreimpl.topType; |
994 Member f = isConst ? tp.getMember('_constMap') : tp.getMember('_map'); | 994 Member f = isConst ? tp.getMember('_constMap') : tp.getMember('_map'); |
995 // TODO(jimhug): Clean up invoke signature | 995 // TODO(jimhug): Clean up invoke signature |
996 var value = f.invoke(null, null, new Value.type(tp, null), | 996 var value = f.invoke(null, null, new Value.type(tp, null), |
997 new Arguments(null, [items])); | 997 new Arguments(null, [items])); |
998 return value.code; | 998 return value.code; |
999 } | 999 } |
1000 | 1000 |
1001 GlobalValue getGlobalValue() { | 1001 GlobalValue getGlobalValue() { |
1002 assert(isConst); | 1002 assert(isConst); |
1003 | 1003 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1225 } | 1225 } |
1226 | 1226 |
1227 _ensureCode(); | 1227 _ensureCode(); |
1228 return null; | 1228 return null; |
1229 } | 1229 } |
1230 } | 1230 } |
1231 | 1231 |
1232 String _escapeForComment(String text) { | 1232 String _escapeForComment(String text) { |
1233 return text.replaceAll('/*', '/ *').replaceAll('*/', '* /'); | 1233 return text.replaceAll('/*', '/ *').replaceAll('*/', '* /'); |
1234 } | 1234 } |
OLD | NEW |