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 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 } | 1037 } |
1038 | 1038 |
1039 /// Returns the disambiguated name for an instance method or field | 1039 /// Returns the disambiguated name for an instance method or field |
1040 /// with [originalName] in [library]. | 1040 /// with [originalName] in [library]. |
1041 /// | 1041 /// |
1042 /// [library] may be `null` if [originalName] is known to be public. | 1042 /// [library] may be `null` if [originalName] is known to be public. |
1043 /// | 1043 /// |
1044 /// This is the name used for deriving property names of accessors (getters | 1044 /// This is the name used for deriving property names of accessors (getters |
1045 /// and setters) and as property name for storing methods and method stubs. | 1045 /// and setters) and as property name for storing methods and method stubs. |
1046 /// | 1046 /// |
1047 /// [suffixes] denote an extension of [originalName] to distiguish it from | 1047 /// [suffixes] denote an extension of [originalName] to distinguish it from |
1048 /// other members with that name. These are used to encode the arity and | 1048 /// other members with that name. These are used to encode the arity and |
1049 /// named parameters to a method. Disambiguating the same [originalName] with | 1049 /// named parameters to a method. Disambiguating the same [originalName] with |
1050 /// different [suffixes] will yield different disambiguated names. | 1050 /// different [suffixes] will yield different disambiguated names. |
1051 /// | 1051 /// |
1052 /// The resulting name, and its associated annotated names, are unique | 1052 /// The resulting name, and its associated annotated names, are unique |
1053 /// to the ([originalName], [suffixes]) pair within the instance-member | 1053 /// to the ([originalName], [suffixes]) pair within the instance-member |
1054 /// namespace. | 1054 /// namespace. |
1055 jsAst.Name _disambiguateMember(Name originalName, | 1055 jsAst.Name _disambiguateMember(Name originalName, |
1056 [List<String> suffixes = const []]) { | 1056 [List<String> suffixes = const []]) { |
1057 // Build a string encoding the library name, if the name is private. | 1057 // Build a string encoding the library name, if the name is private. |
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2183 void addSuggestion(String original, String suggestion) { | 2183 void addSuggestion(String original, String suggestion) { |
2184 assert(!_suggestedNames.containsKey(original)); | 2184 assert(!_suggestedNames.containsKey(original)); |
2185 _suggestedNames[original] = suggestion; | 2185 _suggestedNames[original] = suggestion; |
2186 } | 2186 } |
2187 | 2187 |
2188 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); | 2188 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); |
2189 bool isSuggestion(String candidate) { | 2189 bool isSuggestion(String candidate) { |
2190 return _suggestedNames.containsValue(candidate); | 2190 return _suggestedNames.containsValue(candidate); |
2191 } | 2191 } |
2192 } | 2192 } |
OLD | NEW |