| 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 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 names.add("x"); | 1366 names.add("x"); |
| 1367 } | 1367 } |
| 1368 // Sort the names of the classes after abbreviating them to ensure | 1368 // Sort the names of the classes after abbreviating them to ensure |
| 1369 // the suffix is stable and predictable for the suggested names. | 1369 // the suffix is stable and predictable for the suggested names. |
| 1370 names.sort(); | 1370 names.sort(); |
| 1371 return names.join(); | 1371 return names.join(); |
| 1372 } | 1372 } |
| 1373 | 1373 |
| 1374 /// Property name used for `getInterceptor` or one of its specializations. | 1374 /// Property name used for `getInterceptor` or one of its specializations. |
| 1375 jsAst.Name nameForGetInterceptor(Iterable<ClassEntity> classes) { | 1375 jsAst.Name nameForGetInterceptor(Iterable<ClassEntity> classes) { |
| 1376 FunctionElement getInterceptor = helpers.getInterceptorMethod; | 1376 MethodElement getInterceptor = helpers.getInterceptorMethod; |
| 1377 if (classes.contains(helpers.jsInterceptorClass)) { | 1377 if (classes.contains(helpers.jsInterceptorClass)) { |
| 1378 // If the base Interceptor class is in the set of intercepted classes, we | 1378 // If the base Interceptor class is in the set of intercepted classes, we |
| 1379 // need to go through the generic getInterceptorMethod, since any subclass | 1379 // need to go through the generic getInterceptorMethod, since any subclass |
| 1380 // of the base Interceptor could match. | 1380 // of the base Interceptor could match. |
| 1381 // The unspecialized getInterceptor method can also be accessed through | 1381 // The unspecialized getInterceptor method can also be accessed through |
| 1382 // its element, so we treat this as a user-space global instead of an | 1382 // its element, so we treat this as a user-space global instead of an |
| 1383 // internal global. | 1383 // internal global. |
| 1384 return _disambiguateGlobal(getInterceptor); | 1384 return _disambiguateGlobal(getInterceptor); |
| 1385 } | 1385 } |
| 1386 String suffix = suffixForGetInterceptor(classes); | 1386 String suffix = suffixForGetInterceptor(classes); |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2192 void addSuggestion(String original, String suggestion) { | 2192 void addSuggestion(String original, String suggestion) { |
| 2193 assert(!_suggestedNames.containsKey(original)); | 2193 assert(!_suggestedNames.containsKey(original)); |
| 2194 _suggestedNames[original] = suggestion; | 2194 _suggestedNames[original] = suggestion; |
| 2195 } | 2195 } |
| 2196 | 2196 |
| 2197 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); | 2197 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); |
| 2198 bool isSuggestion(String candidate) { | 2198 bool isSuggestion(String candidate) { |
| 2199 return _suggestedNames.containsValue(candidate); | 2199 return _suggestedNames.containsValue(candidate); |
| 2200 } | 2200 } |
| 2201 } | 2201 } |
| OLD | NEW |