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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 return asName(functionTypeReturnTypeTag); | 629 return asName(functionTypeReturnTypeTag); |
630 case JsGetName.FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG: | 630 case JsGetName.FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG: |
631 return asName(functionTypeRequiredParametersTag); | 631 return asName(functionTypeRequiredParametersTag); |
632 case JsGetName.FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG: | 632 case JsGetName.FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG: |
633 return asName(functionTypeOptionalParametersTag); | 633 return asName(functionTypeOptionalParametersTag); |
634 case JsGetName.FUNCTION_TYPE_NAMED_PARAMETERS_TAG: | 634 case JsGetName.FUNCTION_TYPE_NAMED_PARAMETERS_TAG: |
635 return asName(functionTypeNamedParametersTag); | 635 return asName(functionTypeNamedParametersTag); |
636 case JsGetName.IS_INDEXABLE_FIELD_NAME: | 636 case JsGetName.IS_INDEXABLE_FIELD_NAME: |
637 return operatorIs(helpers.jsIndexingBehaviorInterface); | 637 return operatorIs(helpers.jsIndexingBehaviorInterface); |
638 case JsGetName.NULL_CLASS_TYPE_NAME: | 638 case JsGetName.NULL_CLASS_TYPE_NAME: |
639 return runtimeTypeName(commonElements.nullClass); | 639 ClassElement nullClass = commonElements.nullClass; |
| 640 return runtimeTypeName(nullClass); |
640 case JsGetName.OBJECT_CLASS_TYPE_NAME: | 641 case JsGetName.OBJECT_CLASS_TYPE_NAME: |
641 return runtimeTypeName(commonElements.objectClass); | 642 ClassElement objectClass = commonElements.objectClass; |
| 643 return runtimeTypeName(objectClass); |
642 case JsGetName.FUNCTION_CLASS_TYPE_NAME: | 644 case JsGetName.FUNCTION_CLASS_TYPE_NAME: |
643 return runtimeTypeName(commonElements.functionClass); | 645 ClassElement functionClass = commonElements.functionClass; |
| 646 return runtimeTypeName(functionClass); |
644 default: | 647 default: |
645 reporter.reportErrorMessage(node, MessageKind.GENERIC, | 648 reporter.reportErrorMessage(node, MessageKind.GENERIC, |
646 {'text': 'Error: Namer has no name for "$name".'}); | 649 {'text': 'Error: Namer has no name for "$name".'}); |
647 return asName('BROKEN'); | 650 return asName('BROKEN'); |
648 } | 651 } |
649 } | 652 } |
650 | 653 |
651 /// Return a reference to the given [name]. | 654 /// Return a reference to the given [name]. |
652 /// | 655 /// |
653 /// This is used to ensure that every use site of a name has a unique node so | 656 /// This is used to ensure that every use site of a name has a unique node so |
(...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2202 void addSuggestion(String original, String suggestion) { | 2205 void addSuggestion(String original, String suggestion) { |
2203 assert(!_suggestedNames.containsKey(original)); | 2206 assert(!_suggestedNames.containsKey(original)); |
2204 _suggestedNames[original] = suggestion; | 2207 _suggestedNames[original] = suggestion; |
2205 } | 2208 } |
2206 | 2209 |
2207 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); | 2210 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); |
2208 bool isSuggestion(String candidate) { | 2211 bool isSuggestion(String candidate) { |
2209 return _suggestedNames.containsValue(candidate); | 2212 return _suggestedNames.containsValue(candidate); |
2210 } | 2213 } |
2211 } | 2214 } |
OLD | NEW |