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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 * | 46 * |
47 * Original names are names taken directly from the input. | 47 * Original names are names taken directly from the input. |
48 * | 48 * |
49 * Proposed names are either original names or synthesized names for input | 49 * Proposed names are either original names or synthesized names for input |
50 * elements that do not have original names. | 50 * elements that do not have original names. |
51 * | 51 * |
52 * Disambiguated names are derived from the above, but are mangled to ensure | 52 * Disambiguated names are derived from the above, but are mangled to ensure |
53 * uniqueness within some namespace (e.g. as fields on the same JS object). | 53 * uniqueness within some namespace (e.g. as fields on the same JS object). |
54 * In [MinifyNamer], disambiguated names are also minified. | 54 * In [MinifyNamer], disambiguated names are also minified. |
55 * | 55 * |
56 * Annotated names are names generated from a disambiguated name. Annnotated | 56 * Annotated names are names generated from a disambiguated name. Annotated |
57 * names must be computable at runtime by prefixing/suffixing constant strings | 57 * names must be computable at runtime by prefixing/suffixing constant strings |
58 * onto the disambiguated name. | 58 * onto the disambiguated name. |
59 * | 59 * |
60 * For example, some entity called `x` might be associated with these names: | 60 * For example, some entity called `x` might be associated with these names: |
61 * | 61 * |
62 * Original name: `x` | 62 * Original name: `x` |
63 * | 63 * |
64 * Disambiguated name: `x1` (if something else was called `x`) | 64 * Disambiguated name: `x1` (if something else was called `x`) |
65 * | 65 * |
66 * Annotated names: `x1` (field name) | 66 * Annotated names: `x1` (field name) |
(...skipping 2116 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 |