| 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 part of js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Assigns JavaScript identifiers to Dart variables, class-names and members. | 8 * Assigns JavaScript identifiers to Dart variables, class-names and members. |
| 9 */ | 9 */ |
| 10 class Namer implements ClosureNamer { | 10 class Namer implements ClosureNamer { |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 add(fragment); | 969 add(fragment); |
| 970 } else { | 970 } else { |
| 971 failed = true; | 971 failed = true; |
| 972 } | 972 } |
| 973 } | 973 } |
| 974 | 974 |
| 975 _visit(Constant constant) { | 975 _visit(Constant constant) { |
| 976 return constant.accept(this); | 976 return constant.accept(this); |
| 977 } | 977 } |
| 978 | 978 |
| 979 visitSentinel(SentinelConstant constant) { | |
| 980 add(r'$'); | |
| 981 } | |
| 982 | |
| 983 visitFunction(FunctionConstant constant) { | 979 visitFunction(FunctionConstant constant) { |
| 984 add(constant.element.name.slowToString()); | 980 add(constant.element.name.slowToString()); |
| 985 } | 981 } |
| 986 | 982 |
| 987 visitNull(NullConstant constant) { | 983 visitNull(NullConstant constant) { |
| 988 add('null'); | 984 add('null'); |
| 989 } | 985 } |
| 990 | 986 |
| 991 visitInt(IntConstant constant) { | 987 visitInt(IntConstant constant) { |
| 992 // No `addRoot` since IntConstants are always inlined. | 988 // No `addRoot` since IntConstants are always inlined. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 | 1083 |
| 1088 int _visit(Constant constant) { | 1084 int _visit(Constant constant) { |
| 1089 int hash = hashes[constant]; | 1085 int hash = hashes[constant]; |
| 1090 if (hash == null) { | 1086 if (hash == null) { |
| 1091 hash = _finish(constant.accept(this)); | 1087 hash = _finish(constant.accept(this)); |
| 1092 hashes[constant] = hash; | 1088 hashes[constant] = hash; |
| 1093 } | 1089 } |
| 1094 return hash; | 1090 return hash; |
| 1095 } | 1091 } |
| 1096 | 1092 |
| 1097 int visitSentinel(SentinelConstant constant) => 1; | 1093 int visitNull(NullConstant constant) => 1; |
| 1098 int visitNull(NullConstant constant) => 2; | 1094 int visitTrue(TrueConstant constant) => 2; |
| 1099 int visitTrue(TrueConstant constant) => 3; | 1095 int visitFalse(FalseConstant constant) => 3; |
| 1100 int visitFalse(FalseConstant constant) => 4; | |
| 1101 | 1096 |
| 1102 int visitFunction(FunctionConstant constant) { | 1097 int visitFunction(FunctionConstant constant) { |
| 1103 return _hashString(1, constant.element.name.slowToString()); | 1098 return _hashString(1, constant.element.name.slowToString()); |
| 1104 } | 1099 } |
| 1105 | 1100 |
| 1106 int visitInt(IntConstant constant) => _hashInt(constant.value); | 1101 int visitInt(IntConstant constant) => _hashInt(constant.value); |
| 1107 | 1102 |
| 1108 int visitDouble(DoubleConstant constant) => _hashDouble(constant.value); | 1103 int visitDouble(DoubleConstant constant) => _hashDouble(constant.value); |
| 1109 | 1104 |
| 1110 int visitString(StringConstant constant) { | 1105 int visitString(StringConstant constant) { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 if (!first) { | 1250 if (!first) { |
| 1256 sb.write('_'); | 1251 sb.write('_'); |
| 1257 } | 1252 } |
| 1258 sb.write('_'); | 1253 sb.write('_'); |
| 1259 visit(link.head); | 1254 visit(link.head); |
| 1260 first = true; | 1255 first = true; |
| 1261 } | 1256 } |
| 1262 } | 1257 } |
| 1263 } | 1258 } |
| 1264 } | 1259 } |
| OLD | NEW |