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 library js_backend.namer; | 5 library js_backend.namer; |
6 | 6 |
7 import 'dart:collection' show HashMap; | 7 import 'dart:collection' show HashMap; |
8 | 8 |
9 import 'package:js_runtime/shared/embedded_names.dart' show JsGetName; | 9 import 'package:js_runtime/shared/embedded_names.dart' show JsGetName; |
10 | 10 |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 } | 435 } |
436 | 436 |
437 final String asyncPrefix = r"$async$"; | 437 final String asyncPrefix = r"$async$"; |
438 final String staticStateHolder = r'$'; | 438 final String staticStateHolder = r'$'; |
439 final String getterPrefix = r'get$'; | 439 final String getterPrefix = r'get$'; |
440 final String lazyGetterPrefix = r'$get$'; | 440 final String lazyGetterPrefix = r'$get$'; |
441 final String setterPrefix = r'set$'; | 441 final String setterPrefix = r'set$'; |
442 final String superPrefix = r'super$'; | 442 final String superPrefix = r'super$'; |
443 final String metadataField = '@'; | 443 final String metadataField = '@'; |
444 final String callPrefix = 'call'; | 444 final String callPrefix = 'call'; |
445 final String callCatchAllName = r'call*'; | 445 // Note: We can't shorten 'call*' in the minified namers because the catch-all |
| 446 // formula `name + "*"` is used by mirrors. |
| 447 String get callCatchAllName => r'call*'; |
446 final String callNameField = r'$callName'; | 448 final String callNameField = r'$callName'; |
447 final String stubNameField = r'$stubName'; | 449 final String stubNameField = r'$stubName'; |
448 final String reflectableField = r'$reflectable'; | 450 final String reflectableField = r'$reflectable'; |
449 final String reflectionInfoField = r'$reflectionInfo'; | 451 final String reflectionInfoField = r'$reflectionInfo'; |
450 final String reflectionNameField = r'$reflectionName'; | 452 final String reflectionNameField = r'$reflectionName'; |
451 final String metadataIndexField = r'$metadataIndex'; | 453 final String metadataIndexField = r'$metadataIndex'; |
452 final String defaultValuesField = r'$defaultValues'; | 454 String get requiredParameterField => r'$requiredArgCount'; |
| 455 String get defaultValuesField => r'$defaultValues'; |
453 final String methodsWithOptionalArgumentsField = | 456 final String methodsWithOptionalArgumentsField = |
454 r'$methodsWithOptionalArguments'; | 457 r'$methodsWithOptionalArguments'; |
455 final String deferredAction = r'$deferredAction'; | 458 final String deferredAction = r'$deferredAction'; |
456 | 459 |
457 final String classDescriptorProperty = r'^'; | 460 final String classDescriptorProperty = r'^'; |
458 final String requiredParameterField = r'$requiredArgCount'; | |
459 | 461 |
460 /// The non-minifying namer's [callPrefix] with a dollar after it. | 462 /// The non-minifying namer's [callPrefix] with a dollar after it. |
461 static const String _callPrefixDollar = r'call$'; | 463 static const String _callPrefixDollar = r'call$'; |
462 | 464 |
463 static final jsAst.Name _literalDollar = new StringBackedName(r'$'); | 465 static final jsAst.Name _literalDollar = new StringBackedName(r'$'); |
464 static final jsAst.Name _literalUnderscore = new StringBackedName('_'); | 466 static final jsAst.Name _literalUnderscore = new StringBackedName('_'); |
465 static final jsAst.Name literalPlus = new StringBackedName('+'); | 467 static final jsAst.Name literalPlus = new StringBackedName('+'); |
466 static final jsAst.Name _literalDynamic = new StringBackedName("dynamic"); | 468 static final jsAst.Name _literalDynamic = new StringBackedName("dynamic"); |
467 | 469 |
468 jsAst.Name _literalAsyncPrefix; | 470 jsAst.Name _literalAsyncPrefix; |
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2181 void addSuggestion(String original, String suggestion) { | 2183 void addSuggestion(String original, String suggestion) { |
2182 assert(!_suggestedNames.containsKey(original)); | 2184 assert(!_suggestedNames.containsKey(original)); |
2183 _suggestedNames[original] = suggestion; | 2185 _suggestedNames[original] = suggestion; |
2184 } | 2186 } |
2185 | 2187 |
2186 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); | 2188 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); |
2187 bool isSuggestion(String candidate) { | 2189 bool isSuggestion(String candidate) { |
2188 return _suggestedNames.containsValue(candidate); | 2190 return _suggestedNames.containsValue(candidate); |
2189 } | 2191 } |
2190 } | 2192 } |
OLD | NEW |