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 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 * Returns name of the JavaScript property used to store a static or instance | 899 * Returns name of the JavaScript property used to store a static or instance |
900 * field. | 900 * field. |
901 */ | 901 */ |
902 jsAst.Name fieldPropertyName(FieldElement element) { | 902 jsAst.Name fieldPropertyName(FieldElement element) { |
903 return element.isInstanceMember | 903 return element.isInstanceMember |
904 ? instanceFieldPropertyName(element) | 904 ? instanceFieldPropertyName(element) |
905 : _disambiguateGlobal(element); | 905 : _disambiguateGlobal(element); |
906 } | 906 } |
907 | 907 |
908 /** | 908 /** |
909 * Returns name of the JavaScript property used to store the | |
910 * `readTypeVariable` function for the given type variable. | |
911 */ | |
912 jsAst.Name nameForReadTypeVariable(TypeVariableElement element) { | |
913 return _disambiguateInternalMember(element, () => element.name); | |
914 } | |
915 | |
916 /** | |
917 * Returns a JavaScript property name used to store [element] on one | 909 * Returns a JavaScript property name used to store [element] on one |
918 * of the global objects. | 910 * of the global objects. |
919 * | 911 * |
920 * Should be used together with [globalObjectFor], which denotes the object | 912 * Should be used together with [globalObjectFor], which denotes the object |
921 * on which the returned property name should be used. | 913 * on which the returned property name should be used. |
922 */ | 914 */ |
923 jsAst.Name globalPropertyName(Element element) { | 915 jsAst.Name globalPropertyName(Element element) { |
924 return _disambiguateGlobal(element); | 916 return _disambiguateGlobal(element); |
925 } | 917 } |
926 | 918 |
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2223 void addSuggestion(String original, String suggestion) { | 2215 void addSuggestion(String original, String suggestion) { |
2224 assert(!_suggestedNames.containsKey(original)); | 2216 assert(!_suggestedNames.containsKey(original)); |
2225 _suggestedNames[original] = suggestion; | 2217 _suggestedNames[original] = suggestion; |
2226 } | 2218 } |
2227 | 2219 |
2228 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); | 2220 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); |
2229 bool isSuggestion(String candidate) { | 2221 bool isSuggestion(String candidate) { |
2230 return _suggestedNames.containsValue(candidate); | 2222 return _suggestedNames.containsValue(candidate); |
2231 } | 2223 } |
2232 } | 2224 } |
OLD | NEW |