| 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 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1704 } else if (name == '|') { | 1704 } else if (name == '|') { |
| 1705 return r'$or'; | 1705 return r'$or'; |
| 1706 } else if (name == '-') { | 1706 } else if (name == '-') { |
| 1707 return r'$sub'; | 1707 return r'$sub'; |
| 1708 } else if (name == 'unary-') { | 1708 } else if (name == 'unary-') { |
| 1709 return r'$negate'; | 1709 return r'$negate'; |
| 1710 } else { | 1710 } else { |
| 1711 return name; | 1711 return name; |
| 1712 } | 1712 } |
| 1713 } | 1713 } |
| 1714 | |
| 1715 String get incrementalHelperName => r'$dart_unsafe_incremental_support'; | |
| 1716 | |
| 1717 jsAst.Expression get accessIncrementalHelper { | |
| 1718 return js('self.${incrementalHelperName}'); | |
| 1719 } | |
| 1720 | |
| 1721 void forgetElement(Element element) { | |
| 1722 jsAst.Name globalName = userGlobals[element]; | |
| 1723 invariant(element, globalName != null, message: 'No global name.'); | |
| 1724 userGlobals.remove(element); | |
| 1725 } | |
| 1726 } | 1714 } |
| 1727 | 1715 |
| 1728 /** | 1716 /** |
| 1729 * Generator of names for [ConstantValue] values. | 1717 * Generator of names for [ConstantValue] values. |
| 1730 * | 1718 * |
| 1731 * The names are stable under perturbations of the source. The name is either a | 1719 * The names are stable under perturbations of the source. The name is either a |
| 1732 * short sequence of words, if this can be found from the constant, or a type | 1720 * short sequence of words, if this can be found from the constant, or a type |
| 1733 * followed by a hash tag. | 1721 * followed by a hash tag. |
| 1734 * | 1722 * |
| 1735 * List_imX // A List, with hash tag. | 1723 * List_imX // A List, with hash tag. |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2205 void addSuggestion(String original, String suggestion) { | 2193 void addSuggestion(String original, String suggestion) { |
| 2206 assert(!_suggestedNames.containsKey(original)); | 2194 assert(!_suggestedNames.containsKey(original)); |
| 2207 _suggestedNames[original] = suggestion; | 2195 _suggestedNames[original] = suggestion; |
| 2208 } | 2196 } |
| 2209 | 2197 |
| 2210 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); | 2198 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); |
| 2211 bool isSuggestion(String candidate) { | 2199 bool isSuggestion(String candidate) { |
| 2212 return _suggestedNames.containsValue(candidate); | 2200 return _suggestedNames.containsValue(candidate); |
| 2213 } | 2201 } |
| 2214 } | 2202 } |
| OLD | NEW |