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 class Namer { | 10 class Namer { |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 | 409 |
410 String getLazyInitializerName(Element element) { | 410 String getLazyInitializerName(Element element) { |
411 assert(Elements.isStaticOrTopLevelField(element)); | 411 assert(Elements.isStaticOrTopLevelField(element)); |
412 return getMappedGlobalName("get\$${getName(element)}"); | 412 return getMappedGlobalName("get\$${getName(element)}"); |
413 } | 413 } |
414 | 414 |
415 String isolatePropertiesAccess(Element element) { | 415 String isolatePropertiesAccess(Element element) { |
416 return "$ISOLATE.$ISOLATE_PROPERTIES.${getName(element)}"; | 416 return "$ISOLATE.$ISOLATE_PROPERTIES.${getName(element)}"; |
417 } | 417 } |
418 | 418 |
| 419 String isolatePropertiesAccessForConstant(String constantName) { |
| 420 return "$ISOLATE.$ISOLATE_PROPERTIES.$constantName"; |
| 421 } |
| 422 |
419 String isolateAccess(Element element) { | 423 String isolateAccess(Element element) { |
420 return "$CURRENT_ISOLATE.${getName(element)}"; | 424 return "$CURRENT_ISOLATE.${getName(element)}"; |
421 } | 425 } |
422 | 426 |
423 String isolateBailoutAccess(Element element) { | 427 String isolateBailoutAccess(Element element) { |
424 String newName = getMappedGlobalName('${getName(element)}\$bailout'); | 428 String newName = getMappedGlobalName('${getName(element)}\$bailout'); |
425 return '$CURRENT_ISOLATE.$newName'; | 429 return '$CURRENT_ISOLATE.$newName'; |
426 } | 430 } |
427 | 431 |
428 String isolateLazyInitializerAccess(Element element) { | 432 String isolateLazyInitializerAccess(Element element) { |
429 return "$CURRENT_ISOLATE.${getLazyInitializerName(element)}"; | 433 return "$CURRENT_ISOLATE.${getLazyInitializerName(element)}"; |
430 } | 434 } |
431 | 435 |
432 String operatorIs(Element element) { | 436 String operatorIs(Element element) { |
433 // TODO(erikcorry): Reduce from is$x to ix when we are minifying. | 437 // TODO(erikcorry): Reduce from is$x to ix when we are minifying. |
434 return 'is\$${getName(element)}'; | 438 return 'is\$${getName(element)}'; |
435 } | 439 } |
436 | 440 |
437 String safeName(String name) { | 441 String safeName(String name) { |
438 if (jsReserved.contains(name) || name.startsWith('\$')) { | 442 if (jsReserved.contains(name) || name.startsWith('\$')) { |
439 name = "\$$name"; | 443 name = "\$$name"; |
440 assert(!jsReserved.contains(name)); | 444 assert(!jsReserved.contains(name)); |
441 } | 445 } |
442 return name; | 446 return name; |
443 } | 447 } |
444 } | 448 } |
OLD | NEW |