| 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 part of js_backend; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Assigns JavaScript identifiers to Dart variables, class-names and members. | 8 * Assigns JavaScript identifiers to Dart variables, class-names and members. |
| 9 * | 9 * |
| 10 * Names are generated through three stages: | 10 * Names are generated through three stages: |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 static final jsAst.Name _literalDollar = new StringBackedName(r'$'); | 349 static final jsAst.Name _literalDollar = new StringBackedName(r'$'); |
| 350 static final jsAst.Name _literalUnderscore = new StringBackedName('_'); | 350 static final jsAst.Name _literalUnderscore = new StringBackedName('_'); |
| 351 static final jsAst.Name literalPlus = new StringBackedName('+'); | 351 static final jsAst.Name literalPlus = new StringBackedName('+'); |
| 352 static final jsAst.Name _literalDynamic = new StringBackedName("dynamic"); | 352 static final jsAst.Name _literalDynamic = new StringBackedName("dynamic"); |
| 353 | 353 |
| 354 jsAst.Name _literalAsyncPrefix; | 354 jsAst.Name _literalAsyncPrefix; |
| 355 jsAst.Name _literalGetterPrefix; | 355 jsAst.Name _literalGetterPrefix; |
| 356 jsAst.Name _literalSetterPrefix; | 356 jsAst.Name _literalSetterPrefix; |
| 357 jsAst.Name _literalLazyGetterPrefix; | 357 jsAst.Name _literalLazyGetterPrefix; |
| 358 | 358 |
| 359 jsAst.Name _staticsPropertyName; |
| 360 |
| 361 jsAst.Name get staticsPropertyName => |
| 362 _staticsPropertyName ??= new StringBackedName('static'); |
| 363 |
| 359 // Name of property in a class description for the native dispatch metadata. | 364 // Name of property in a class description for the native dispatch metadata. |
| 360 final String nativeSpecProperty = '%'; | 365 final String nativeSpecProperty = '%'; |
| 361 | 366 |
| 362 static final RegExp IDENTIFIER = new RegExp(r'^[A-Za-z_$][A-Za-z0-9_$]*$'); | 367 static final RegExp IDENTIFIER = new RegExp(r'^[A-Za-z_$][A-Za-z0-9_$]*$'); |
| 363 static final RegExp NON_IDENTIFIER_CHAR = new RegExp(r'[^A-Za-z_0-9$]'); | 368 static final RegExp NON_IDENTIFIER_CHAR = new RegExp(r'[^A-Za-z_0-9$]'); |
| 364 | 369 |
| 365 final Compiler compiler; | 370 final Compiler compiler; |
| 366 | 371 |
| 367 /// Used disambiguated names in the global namespace, issued by | 372 /// Used disambiguated names in the global namespace, issued by |
| 368 /// [_disambiguateGlobal], and [_disambiguateInternalGlobal]. | 373 /// [_disambiguateGlobal], and [_disambiguateInternalGlobal]. |
| (...skipping 1670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2039 String suggestName(String original) => _suggestedNames[original]; | 2044 String suggestName(String original) => _suggestedNames[original]; |
| 2040 void addSuggestion(String original, String suggestion) { | 2045 void addSuggestion(String original, String suggestion) { |
| 2041 assert(!_suggestedNames.containsKey(original)); | 2046 assert(!_suggestedNames.containsKey(original)); |
| 2042 _suggestedNames[original] = suggestion; | 2047 _suggestedNames[original] = suggestion; |
| 2043 } | 2048 } |
| 2044 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); | 2049 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); |
| 2045 bool isSuggestion(String candidate) { | 2050 bool isSuggestion(String candidate) { |
| 2046 return _suggestedNames.containsValue(candidate); | 2051 return _suggestedNames.containsValue(candidate); |
| 2047 } | 2052 } |
| 2048 } | 2053 } |
| OLD | NEW |