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 part of js_backend; | 5 library js_backend.namer; |
| 6 |
| 7 import 'dart:collection' show HashMap; |
| 8 |
| 9 import 'package:js_runtime/shared/embedded_names.dart' show JsGetName; |
| 10 |
| 11 import '../closure.dart'; |
| 12 import '../common.dart'; |
| 13 import '../common/names.dart' show Identifiers, Names, Selectors, Uris; |
| 14 import '../compiler.dart' show Compiler; |
| 15 import '../constants/values.dart'; |
| 16 import '../core_types.dart' show CoreClasses, CoreTypes; |
| 17 import '../dart_types.dart'; |
| 18 import '../diagnostics/invariant.dart' show DEBUG_MODE; |
| 19 import '../elements/elements.dart'; |
| 20 import '../js/js.dart' as jsAst; |
| 21 import '../js/js.dart' show js; |
| 22 import '../tree/tree.dart'; |
| 23 import '../universe/call_structure.dart' show CallStructure; |
| 24 import '../universe/selector.dart' show Selector, SelectorKind; |
| 25 import '../util/characters.dart'; |
| 26 import '../util/util.dart'; |
| 27 import '../world.dart' show ClassWorld; |
| 28 import 'backend.dart'; |
| 29 import 'backend_helpers.dart'; |
| 30 import 'constant_system_javascript.dart'; |
| 31 |
| 32 part 'field_naming_mixin.dart'; |
| 33 part 'frequency_namer.dart'; |
| 34 part 'minify_namer.dart'; |
| 35 part 'namer_names.dart'; |
6 | 36 |
7 /** | 37 /** |
8 * Assigns JavaScript identifiers to Dart variables, class-names and members. | 38 * Assigns JavaScript identifiers to Dart variables, class-names and members. |
9 * | 39 * |
10 * Names are generated through three stages: | 40 * Names are generated through three stages: |
11 * | 41 * |
12 * 1. Original names and proposed names | 42 * 1. Original names and proposed names |
13 * 2. Disambiguated names (also known as "mangled names") | 43 * 2. Disambiguated names (also known as "mangled names") |
14 * 3. Annotated names | 44 * 3. Annotated names |
15 * | 45 * |
(...skipping 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2057 void addSuggestion(String original, String suggestion) { | 2087 void addSuggestion(String original, String suggestion) { |
2058 assert(!_suggestedNames.containsKey(original)); | 2088 assert(!_suggestedNames.containsKey(original)); |
2059 _suggestedNames[original] = suggestion; | 2089 _suggestedNames[original] = suggestion; |
2060 } | 2090 } |
2061 | 2091 |
2062 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); | 2092 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); |
2063 bool isSuggestion(String candidate) { | 2093 bool isSuggestion(String candidate) { |
2064 return _suggestedNames.containsValue(candidate); | 2094 return _suggestedNames.containsValue(candidate); |
2065 } | 2095 } |
2066 } | 2096 } |
OLD | NEW |