Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/namer.dart

Issue 11308175: Emit constants using ASTs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address code-review comments Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
423 String isolateAccess(Element element) { 419 String isolateAccess(Element element) {
424 return "$CURRENT_ISOLATE.${getName(element)}"; 420 return "$CURRENT_ISOLATE.${getName(element)}";
425 } 421 }
426 422
427 String isolateBailoutAccess(Element element) { 423 String isolateBailoutAccess(Element element) {
428 String newName = getMappedGlobalName('${getName(element)}\$bailout'); 424 String newName = getMappedGlobalName('${getName(element)}\$bailout');
429 return '$CURRENT_ISOLATE.$newName'; 425 return '$CURRENT_ISOLATE.$newName';
430 } 426 }
431 427
432 String isolateLazyInitializerAccess(Element element) { 428 String isolateLazyInitializerAccess(Element element) {
433 return "$CURRENT_ISOLATE.${getLazyInitializerName(element)}"; 429 return "$CURRENT_ISOLATE.${getLazyInitializerName(element)}";
434 } 430 }
435 431
436 String operatorIs(Element element) { 432 String operatorIs(Element element) {
437 // TODO(erikcorry): Reduce from is$x to ix when we are minifying. 433 // TODO(erikcorry): Reduce from is$x to ix when we are minifying.
438 return 'is\$${getName(element)}'; 434 return 'is\$${getName(element)}';
439 } 435 }
440 436
441 String safeName(String name) { 437 String safeName(String name) {
442 if (jsReserved.contains(name) || name.startsWith('\$')) { 438 if (jsReserved.contains(name) || name.startsWith('\$')) {
443 name = "\$$name"; 439 name = "\$$name";
444 assert(!jsReserved.contains(name)); 440 assert(!jsReserved.contains(name));
445 } 441 }
446 return name; 442 return name;
447 } 443 }
448 } 444 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698