| 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 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1780 } else { | 1780 } else { |
| 1781 // Using some bits from the keys hash tag groups the names Maps with the | 1781 // Using some bits from the keys hash tag groups the names Maps with the |
| 1782 // same structure. | 1782 // same structure. |
| 1783 add(getHashTag(constant.keyList, 2) + getHashTag(constant, 3)); | 1783 add(getHashTag(constant.keyList, 2) + getHashTag(constant, 3)); |
| 1784 } | 1784 } |
| 1785 } | 1785 } |
| 1786 | 1786 |
| 1787 @override | 1787 @override |
| 1788 void visitConstructed(ConstructedConstantValue constant, [_]) { | 1788 void visitConstructed(ConstructedConstantValue constant, [_]) { |
| 1789 addRoot(constant.type.element.name); | 1789 addRoot(constant.type.element.name); |
| 1790 // TODO(johnniwinther): This should be accessed from a codegen closed world. |
| 1790 codegenWorldBuilder.forEachInstanceField(constant.type.element, | 1791 codegenWorldBuilder.forEachInstanceField(constant.type.element, |
| 1791 (_, FieldElement field) { | 1792 (_, FieldElement field) { |
| 1792 if (failed) return; | 1793 if (failed) return; |
| 1793 _visit(constant.fields[field]); | 1794 _visit(constant.fields[field]); |
| 1794 }); | 1795 }); |
| 1795 } | 1796 } |
| 1796 | 1797 |
| 1797 @override | 1798 @override |
| 1798 void visitType(TypeConstantValue constant, [_]) { | 1799 void visitType(TypeConstantValue constant, [_]) { |
| 1799 // Generates something like 'Type_String_k8F', using the simple name of the | 1800 // Generates something like 'Type_String_k8F', using the simple name of the |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2105 void addSuggestion(String original, String suggestion) { | 2106 void addSuggestion(String original, String suggestion) { |
| 2106 assert(!_suggestedNames.containsKey(original)); | 2107 assert(!_suggestedNames.containsKey(original)); |
| 2107 _suggestedNames[original] = suggestion; | 2108 _suggestedNames[original] = suggestion; |
| 2108 } | 2109 } |
| 2109 | 2110 |
| 2110 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); | 2111 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); |
| 2111 bool isSuggestion(String candidate) { | 2112 bool isSuggestion(String candidate) { |
| 2112 return _suggestedNames.containsValue(candidate); | 2113 return _suggestedNames.containsValue(candidate); |
| 2113 } | 2114 } |
| 2114 } | 2115 } |
| OLD | NEW |