OLD | NEW |
---|---|
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 /** A formal parameter to a [Method]. */ | 5 /** A formal parameter to a [Method]. */ |
6 class Parameter { | 6 class Parameter { |
7 FormalNode definition; | 7 FormalNode definition; |
8 | 8 |
9 String name; | 9 String name; |
10 Type type; | 10 Type type; |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1011 return new Value(declaringType, '${target.code}[${argsCode[0]}]'); | 1011 return new Value(declaringType, '${target.code}[${argsCode[0]}]'); |
1012 } else if (name == '\$add') { | 1012 } else if (name == '\$add') { |
1013 if (allConst) { | 1013 if (allConst) { |
1014 var val0 = target.dynamic.actualValue; | 1014 var val0 = target.dynamic.actualValue; |
1015 val0 = val0.substring(1, val0.length - 1); | 1015 val0 = val0.substring(1, val0.length - 1); |
1016 var val1 = args.values[0].dynamic.actualValue; | 1016 var val1 = args.values[0].dynamic.actualValue; |
1017 if (args.values[0].type.isString) { | 1017 if (args.values[0].type.isString) { |
1018 val1 = val1.substring(1, val1.length - 1); | 1018 val1 = val1.substring(1, val1.length - 1); |
1019 } | 1019 } |
1020 var value = '${val0}${val1}'; | 1020 var value = '${val0}${val1}'; |
1021 var escapedValue = value.replaceAll('"', '\\"'); | 1021 value = '"' + value.replaceAll('"', '\\"') + '"'; |
ahe
2011/11/02 18:17:58
What happens with these strings:
"\""
'\\"'
jimhug
2011/11/03 00:57:21
This does seem to fix this issue - but I share Pet
Siggi Cherem (dart-lang)
2011/11/03 17:31:28
The issue is basically how we are representing str
Jennifer Messerly
2011/11/03 17:49:40
+1 on normalizing strings in the tokenizer, rather
| |
1022 return new EvaluatedValue(world.stringType, value, '"$escapedValue"', | 1022 return new EvaluatedValue(world.stringType, value, value, node.span); |
1023 node.span); | |
1024 } | 1023 } |
1025 | 1024 |
1026 // Ensure we generate toString on the right side | 1025 // Ensure we generate toString on the right side |
1027 args.values[0].invoke(world.gen, 'toString', node, Arguments.EMPTY); | 1026 args.values[0].invoke(world.gen, 'toString', node, Arguments.EMPTY); |
1028 return new Value(declaringType, '${target.code} + ${argsCode[0]}'); | 1027 return new Value(declaringType, '${target.code} + ${argsCode[0]}'); |
1029 } | 1028 } |
1030 } else if (declaringType.isNativeType) { | 1029 } else if (declaringType.isNativeType) { |
1031 if (name == '\$index') { | 1030 if (name == '\$index') { |
1032 // Note: this could technically propagate constness, but that's not | 1031 // Note: this could technically propagate constness, but that's not |
1033 // specified explicitly and the VM doesn't do that. | 1032 // specified explicitly and the VM doesn't do that. |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1402 } | 1401 } |
1403 | 1402 |
1404 void forEach(void f(MethodMember member)) { | 1403 void forEach(void f(MethodMember member)) { |
1405 factories.forEach((_, Map constructors) { | 1404 factories.forEach((_, Map constructors) { |
1406 constructors.forEach((_, Member member) { | 1405 constructors.forEach((_, Member member) { |
1407 f(member); | 1406 f(member); |
1408 }); | 1407 }); |
1409 }); | 1408 }); |
1410 } | 1409 } |
1411 } | 1410 } |
OLD | NEW |