| 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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 jsAst.Name _literalAsyncPrefix; | 468 jsAst.Name _literalAsyncPrefix; |
| 469 jsAst.Name _literalGetterPrefix; | 469 jsAst.Name _literalGetterPrefix; |
| 470 jsAst.Name _literalSetterPrefix; | 470 jsAst.Name _literalSetterPrefix; |
| 471 jsAst.Name _literalLazyGetterPrefix; | 471 jsAst.Name _literalLazyGetterPrefix; |
| 472 | 472 |
| 473 jsAst.Name _staticsPropertyName; | 473 jsAst.Name _staticsPropertyName; |
| 474 | 474 |
| 475 jsAst.Name get staticsPropertyName => | 475 jsAst.Name get staticsPropertyName => |
| 476 _staticsPropertyName ??= new StringBackedName('static'); | 476 _staticsPropertyName ??= new StringBackedName('static'); |
| 477 | 477 |
| 478 jsAst.Name _rtiFieldName; | 478 final String rtiName = r'$ti'; |
| 479 jsAst.Name get rtiFieldName => _rtiFieldName ??= new StringBackedName(r'$ti'); | 479 |
| 480 jsAst.Name _rtiFieldJsName; |
| 481 jsAst.Name get rtiFieldJsName => |
| 482 _rtiFieldJsName ??= new StringBackedName(rtiName); |
| 480 | 483 |
| 481 // Name of property in a class description for the native dispatch metadata. | 484 // Name of property in a class description for the native dispatch metadata. |
| 482 final String nativeSpecProperty = '%'; | 485 final String nativeSpecProperty = '%'; |
| 483 | 486 |
| 484 static final RegExp IDENTIFIER = new RegExp(r'^[A-Za-z_$][A-Za-z0-9_$]*$'); | 487 static final RegExp IDENTIFIER = new RegExp(r'^[A-Za-z_$][A-Za-z0-9_$]*$'); |
| 485 static final RegExp NON_IDENTIFIER_CHAR = new RegExp(r'[^A-Za-z_0-9$]'); | 488 static final RegExp NON_IDENTIFIER_CHAR = new RegExp(r'[^A-Za-z_0-9$]'); |
| 486 | 489 |
| 487 final JavaScriptBackend backend; | 490 final JavaScriptBackend backend; |
| 488 final ClosedWorld closedWorld; | 491 final ClosedWorld closedWorld; |
| 489 final CodegenWorldBuilder codegenWorldBuilder; | 492 final CodegenWorldBuilder codegenWorldBuilder; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 case JsGetName.DEFAULT_VALUES_PROPERTY: | 616 case JsGetName.DEFAULT_VALUES_PROPERTY: |
| 614 return asName(defaultValuesField); | 617 return asName(defaultValuesField); |
| 615 case JsGetName.CALL_NAME_PROPERTY: | 618 case JsGetName.CALL_NAME_PROPERTY: |
| 616 return asName(callNameField); | 619 return asName(callNameField); |
| 617 case JsGetName.DEFERRED_ACTION_PROPERTY: | 620 case JsGetName.DEFERRED_ACTION_PROPERTY: |
| 618 return asName(deferredAction); | 621 return asName(deferredAction); |
| 619 case JsGetName.OPERATOR_AS_PREFIX: | 622 case JsGetName.OPERATOR_AS_PREFIX: |
| 620 return asName(operatorAsPrefix); | 623 return asName(operatorAsPrefix); |
| 621 case JsGetName.SIGNATURE_NAME: | 624 case JsGetName.SIGNATURE_NAME: |
| 622 return asName(operatorSignature); | 625 return asName(operatorSignature); |
| 626 case JsGetName.RTI_NAME: |
| 627 return asName(rtiName); |
| 623 case JsGetName.TYPEDEF_TAG: | 628 case JsGetName.TYPEDEF_TAG: |
| 624 return asName(typedefTag); | 629 return asName(typedefTag); |
| 630 case JsGetName.FUNCTION_TYPE_TAG: |
| 631 return asName(functionTypeTag); |
| 625 case JsGetName.FUNCTION_TYPE_VOID_RETURN_TAG: | 632 case JsGetName.FUNCTION_TYPE_VOID_RETURN_TAG: |
| 626 return asName(functionTypeVoidReturnTag); | 633 return asName(functionTypeVoidReturnTag); |
| 627 case JsGetName.FUNCTION_TYPE_RETURN_TYPE_TAG: | 634 case JsGetName.FUNCTION_TYPE_RETURN_TYPE_TAG: |
| 628 return asName(functionTypeReturnTypeTag); | 635 return asName(functionTypeReturnTypeTag); |
| 629 case JsGetName.FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG: | 636 case JsGetName.FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG: |
| 630 return asName(functionTypeRequiredParametersTag); | 637 return asName(functionTypeRequiredParametersTag); |
| 631 case JsGetName.FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG: | 638 case JsGetName.FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG: |
| 632 return asName(functionTypeOptionalParametersTag); | 639 return asName(functionTypeOptionalParametersTag); |
| 633 case JsGetName.FUNCTION_TYPE_NAMED_PARAMETERS_TAG: | 640 case JsGetName.FUNCTION_TYPE_NAMED_PARAMETERS_TAG: |
| 634 return asName(functionTypeNamedParametersTag); | 641 return asName(functionTypeNamedParametersTag); |
| (...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2191 void addSuggestion(String original, String suggestion) { | 2198 void addSuggestion(String original, String suggestion) { |
| 2192 assert(!_suggestedNames.containsKey(original)); | 2199 assert(!_suggestedNames.containsKey(original)); |
| 2193 _suggestedNames[original] = suggestion; | 2200 _suggestedNames[original] = suggestion; |
| 2194 } | 2201 } |
| 2195 | 2202 |
| 2196 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); | 2203 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); |
| 2197 bool isSuggestion(String candidate) { | 2204 bool isSuggestion(String candidate) { |
| 2198 return _suggestedNames.containsValue(candidate); | 2205 return _suggestedNames.containsValue(candidate); |
| 2199 } | 2206 } |
| 2200 } | 2207 } |
| OLD | NEW |