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

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

Issue 266913017: Convert property methods into getters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 6 years, 7 months 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 implements ClosureNamer { 10 class Namer implements ClosureNamer {
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 } 373 }
374 } 374 }
375 375
376 String instanceMethodName(FunctionElement element) { 376 String instanceMethodName(FunctionElement element) {
377 // TODO(ahe): Could this be: return invocationName(new 377 // TODO(ahe): Could this be: return invocationName(new
378 // Selector.fromElement(element))? 378 // Selector.fromElement(element))?
379 String elementName = element.name; 379 String elementName = element.name;
380 String name = operatorNameToIdentifier(elementName); 380 String name = operatorNameToIdentifier(elementName);
381 if (name != elementName) return getMappedOperatorName(name); 381 if (name != elementName) return getMappedOperatorName(name);
382 382
383 LibraryElement library = element.getLibrary(); 383 LibraryElement library = element.library;
384 if (element.isGenerativeConstructorBody()) { 384 if (element.isGenerativeConstructorBody) {
385 name = Elements.reconstructConstructorNameSourceString(element); 385 name = Elements.reconstructConstructorNameSourceString(element);
386 } 386 }
387 FunctionSignature signature = element.functionSignature; 387 FunctionSignature signature = element.functionSignature;
388 // We don't mangle the closure invoking function name because it 388 // We don't mangle the closure invoking function name because it
389 // is generated by string concatenation in applyFunction from 389 // is generated by string concatenation in applyFunction from
390 // js_helper.dart. To keep code size down, we potentially shorten 390 // js_helper.dart. To keep code size down, we potentially shorten
391 // the prefix though. 391 // the prefix though.
392 String methodName; 392 String methodName;
393 if (name == closureInvocationSelectorName) { 393 if (name == closureInvocationSelectorName) {
394 methodName = '$callPrefix\$${signature.parameterCount}'; 394 methodName = '$callPrefix\$${signature.parameterCount}';
(...skipping 19 matching lines...) Expand all
414 // We don't mangle the closure invoking function name because it 414 // We don't mangle the closure invoking function name because it
415 // is generated by string concatenation in applyFunction from 415 // is generated by string concatenation in applyFunction from
416 // js_helper.dart. To keep code size down, we potentially shorten 416 // js_helper.dart. To keep code size down, we potentially shorten
417 // the prefix though. 417 // the prefix though.
418 if (name == closureInvocationSelectorName) return '$callPrefix\$$arity'; 418 if (name == closureInvocationSelectorName) return '$callPrefix\$$arity';
419 419
420 return getMappedInstanceName('$name\$$arity'); 420 return getMappedInstanceName('$name\$$arity');
421 } 421 }
422 422
423 String invocationName(Selector selector) { 423 String invocationName(Selector selector) {
424 if (selector.isGetter()) { 424 if (selector.isGetter) {
425 String proposedName = privateName(selector.library, selector.name); 425 String proposedName = privateName(selector.library, selector.name);
426 return '$getterPrefix${getMappedInstanceName(proposedName)}'; 426 return '$getterPrefix${getMappedInstanceName(proposedName)}';
427 } else if (selector.isSetter()) { 427 } else if (selector.isSetter) {
428 String proposedName = privateName(selector.library, selector.name); 428 String proposedName = privateName(selector.library, selector.name);
429 return '$setterPrefix${getMappedInstanceName(proposedName)}'; 429 return '$setterPrefix${getMappedInstanceName(proposedName)}';
430 } else { 430 } else {
431 String name = selector.name; 431 String name = selector.name;
432 if (selector.kind == SelectorKind.OPERATOR 432 if (selector.kind == SelectorKind.OPERATOR
433 || selector.kind == SelectorKind.INDEX) { 433 || selector.kind == SelectorKind.INDEX) {
434 name = operatorNameToIdentifier(name); 434 name = operatorNameToIdentifier(name);
435 assert(name != selector.name); 435 assert(name != selector.name);
436 return getMappedOperatorName(name); 436 return getMappedOperatorName(name);
437 } 437 }
438 assert(name == operatorNameToIdentifier(name)); 438 assert(name == operatorNameToIdentifier(name));
439 StringBuffer buffer = new StringBuffer(); 439 StringBuffer buffer = new StringBuffer();
440 for (String argumentName in selector.getOrderedNamedArguments()) { 440 for (String argumentName in selector.getOrderedNamedArguments()) {
441 buffer.write('\$${safeName(argumentName)}'); 441 buffer.write('\$${safeName(argumentName)}');
442 } 442 }
443 String suffix = '\$${selector.argumentCount}$buffer'; 443 String suffix = '\$${selector.argumentCount}$buffer';
444 // We don't mangle the closure invoking function name because it 444 // We don't mangle the closure invoking function name because it
445 // is generated by string concatenation in applyFunction from 445 // is generated by string concatenation in applyFunction from
446 // js_helper.dart. We potentially shorten the prefix though. 446 // js_helper.dart. We potentially shorten the prefix though.
447 if (selector.isClosureCall()) { 447 if (selector.isClosureCall) {
448 return "$callPrefix$suffix"; 448 return "$callPrefix$suffix";
449 } else { 449 } else {
450 String proposedName = privateName(selector.library, name); 450 String proposedName = privateName(selector.library, name);
451 return getMappedInstanceName('$proposedName$suffix'); 451 return getMappedInstanceName('$proposedName$suffix');
452 } 452 }
453 } 453 }
454 } 454 }
455 455
456 /** 456 /**
457 * Returns the internal name used for an invocation mirror of this selector. 457 * Returns the internal name used for an invocation mirror of this selector.
458 */ 458 */
459 String invocationMirrorInternalName(Selector selector) 459 String invocationMirrorInternalName(Selector selector)
460 => invocationName(selector); 460 => invocationName(selector);
461 461
462 /** 462 /**
463 * Returns name of accessor (root to getter and setter) for a static or 463 * Returns name of accessor (root to getter and setter) for a static or
464 * instance field. 464 * instance field.
465 */ 465 */
466 String fieldAccessorName(Element element) { 466 String fieldAccessorName(Element element) {
467 return element.isInstanceMember() 467 return element.isInstanceMember
468 ? instanceFieldAccessorName(element) 468 ? instanceFieldAccessorName(element)
469 : getNameOfField(element); 469 : getNameOfField(element);
470 } 470 }
471 471
472 /** 472 /**
473 * Returns name of the JavaScript property used to store a static or instance 473 * Returns name of the JavaScript property used to store a static or instance
474 * field. 474 * field.
475 */ 475 */
476 String fieldPropertyName(Element element) { 476 String fieldPropertyName(Element element) {
477 return element.isInstanceMember() 477 return element.isInstanceMember
478 ? instanceFieldPropertyName(element) 478 ? instanceFieldPropertyName(element)
479 : getNameOfField(element); 479 : getNameOfField(element);
480 } 480 }
481 481
482 /** 482 /**
483 * Returns name of accessor (root to getter and setter) for an instance field. 483 * Returns name of accessor (root to getter and setter) for an instance field.
484 */ 484 */
485 String instanceFieldAccessorName(Element element) { 485 String instanceFieldAccessorName(Element element) {
486 String proposedName = privateName(element.getLibrary(), element.name); 486 String proposedName = privateName(element.library, element.name);
487 return getMappedInstanceName(proposedName); 487 return getMappedInstanceName(proposedName);
488 } 488 }
489 489
490 String readTypeVariableName(TypeVariableElement element) { 490 String readTypeVariableName(TypeVariableElement element) {
491 return '\$tv_${instanceFieldAccessorName(element)}'; 491 return '\$tv_${instanceFieldAccessorName(element)}';
492 } 492 }
493 493
494 /** 494 /**
495 * Returns name of the JavaScript property used to store an instance field. 495 * Returns name of the JavaScript property used to store an instance field.
496 */ 496 */
497 String instanceFieldPropertyName(Element element) { 497 String instanceFieldPropertyName(Element element) {
498 if (element.hasFixedBackendName()) { 498 if (element.hasFixedBackendName) {
499 return element.fixedBackendName(); 499 return element.fixedBackendName;
500 } 500 }
501 // If a class is used anywhere as a mixin, we must make the name unique so 501 // If a class is used anywhere as a mixin, we must make the name unique so
502 // that it does not accidentally shadow. Also, the mixin name must be 502 // that it does not accidentally shadow. Also, the mixin name must be
503 // constant over all mixins. 503 // constant over all mixins.
504 if (compiler.world.isUsedAsMixin(element.getEnclosingClass()) || 504 if (compiler.world.isUsedAsMixin(element.enclosingClass) ||
505 shadowingAnotherField(element)) { 505 shadowingAnotherField(element)) {
506 // Construct a new name for the element based on the library and class it 506 // Construct a new name for the element based on the library and class it
507 // is in. The name here is not important, we just need to make sure it is 507 // is in. The name here is not important, we just need to make sure it is
508 // unique. If we are minifying, we actually construct the name from the 508 // unique. If we are minifying, we actually construct the name from the
509 // minified version of the class name, but the result is minified once 509 // minified version of the class name, but the result is minified once
510 // again, so that is not visible in the end result. 510 // again, so that is not visible in the end result.
511 String libraryName = getNameOfLibrary(element.getLibrary()); 511 String libraryName = getNameOfLibrary(element.library);
512 String className = getNameOfClass(element.getEnclosingClass()); 512 String className = getNameOfClass(element.enclosingClass);
513 String instanceName = privateName(element.getLibrary(), element.name); 513 String instanceName = privateName(element.library, element.name);
514 return getMappedInstanceName('$libraryName\$$className\$$instanceName'); 514 return getMappedInstanceName('$libraryName\$$className\$$instanceName');
515 } 515 }
516 516
517 String proposedName = privateName(element.getLibrary(), element.name); 517 String proposedName = privateName(element.library, element.name);
518 return getMappedInstanceName(proposedName); 518 return getMappedInstanceName(proposedName);
519 } 519 }
520 520
521 521
522 bool shadowingAnotherField(Element element) { 522 bool shadowingAnotherField(Element element) {
523 return element.getEnclosingClass().hasFieldShadowedBy(element); 523 return element.enclosingClass.hasFieldShadowedBy(element);
524 } 524 }
525 525
526 String setterName(Element element) { 526 String setterName(Element element) {
527 // We dynamically create setters from the field-name. The setter name must 527 // We dynamically create setters from the field-name. The setter name must
528 // therefore be derived from the instance field-name. 528 // therefore be derived from the instance field-name.
529 LibraryElement library = element.getLibrary(); 529 LibraryElement library = element.library;
530 String name = getMappedInstanceName(privateName(library, element.name)); 530 String name = getMappedInstanceName(privateName(library, element.name));
531 return '$setterPrefix$name'; 531 return '$setterPrefix$name';
532 } 532 }
533 533
534 String setterNameFromAccessorName(String name) { 534 String setterNameFromAccessorName(String name) {
535 // We dynamically create setters from the field-name. The setter name must 535 // We dynamically create setters from the field-name. The setter name must
536 // therefore be derived from the instance field-name. 536 // therefore be derived from the instance field-name.
537 return '$setterPrefix$name'; 537 return '$setterPrefix$name';
538 } 538 }
539 539
540 String getterNameFromAccessorName(String name) { 540 String getterNameFromAccessorName(String name) {
541 // We dynamically create getters from the field-name. The getter name must 541 // We dynamically create getters from the field-name. The getter name must
542 // therefore be derived from the instance field-name. 542 // therefore be derived from the instance field-name.
543 return '$getterPrefix$name'; 543 return '$getterPrefix$name';
544 } 544 }
545 545
546 String getterName(Element element) { 546 String getterName(Element element) {
547 // We dynamically create getters from the field-name. The getter name must 547 // We dynamically create getters from the field-name. The getter name must
548 // therefore be derived from the instance field-name. 548 // therefore be derived from the instance field-name.
549 LibraryElement library = element.getLibrary(); 549 LibraryElement library = element.library;
550 String name = getMappedInstanceName(privateName(library, element.name)); 550 String name = getMappedInstanceName(privateName(library, element.name));
551 return '$getterPrefix$name'; 551 return '$getterPrefix$name';
552 } 552 }
553 553
554 String getMappedGlobalName(String proposedName, {bool ensureSafe: true}) { 554 String getMappedGlobalName(String proposedName, {bool ensureSafe: true}) {
555 var newName = globalNameMap[proposedName]; 555 var newName = globalNameMap[proposedName];
556 if (newName == null) { 556 if (newName == null) {
557 newName = getFreshName(proposedName, usedGlobalNames, 557 newName = getFreshName(proposedName, usedGlobalNames,
558 suggestedGlobalNames, ensureSafe: ensureSafe); 558 suggestedGlobalNames, ensureSafe: ensureSafe);
559 globalNameMap[proposedName] = newName; 559 globalNameMap[proposedName] = newName;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 607
608 String getClosureVariableName(String name, int id) { 608 String getClosureVariableName(String name, int id) {
609 return "${name}_$id"; 609 return "${name}_$id";
610 } 610 }
611 611
612 /** 612 /**
613 * Returns a preferred JS-id for the given top-level or static element. 613 * Returns a preferred JS-id for the given top-level or static element.
614 * The returned id is guaranteed to be a valid JS-id. 614 * The returned id is guaranteed to be a valid JS-id.
615 */ 615 */
616 String _computeGuess(Element element) { 616 String _computeGuess(Element element) {
617 assert(!element.isInstanceMember()); 617 assert(!element.isInstanceMember);
618 String name; 618 String name;
619 if (element.isGenerativeConstructor()) { 619 if (element.isGenerativeConstructor) {
620 name = "${element.getEnclosingClass().name}\$" 620 name = "${element.enclosingClass.name}\$"
621 "${element.name}"; 621 "${element.name}";
622 } else if (element.isFactoryConstructor()) { 622 } else if (element.isFactoryConstructor) {
623 // TODO(johnniwinther): Change factory name encoding as to not include 623 // TODO(johnniwinther): Change factory name encoding as to not include
624 // the class-name twice. 624 // the class-name twice.
625 String className = element.getEnclosingClass().name; 625 String className = element.enclosingClass.name;
626 name = '${className}_${Elements.reconstructConstructorName(element)}'; 626 name = '${className}_${Elements.reconstructConstructorName(element)}';
627 } else if (Elements.isStaticOrTopLevel(element)) { 627 } else if (Elements.isStaticOrTopLevel(element)) {
628 if (element.isMember()) { 628 if (element.isMember) {
629 ClassElement enclosingClass = element.getEnclosingClass(); 629 ClassElement enclosingClass = element.enclosingClass;
630 name = "${enclosingClass.name}_" 630 name = "${enclosingClass.name}_"
631 "${element.name}"; 631 "${element.name}";
632 } else { 632 } else {
633 name = element.name.replaceAll('+', '_'); 633 name = element.name.replaceAll('+', '_');
634 } 634 }
635 } else if (element.isLibrary()) { 635 } else if (element.isLibrary) {
636 LibraryElement library = element; 636 LibraryElement library = element;
637 name = library.getLibraryOrScriptName(); 637 name = library.getLibraryOrScriptName();
638 if (name.contains('.')) { 638 if (name.contains('.')) {
639 // For libraries that have a library tag, we use the last part 639 // For libraries that have a library tag, we use the last part
640 // of the fully qualified name as their base name. For all other 640 // of the fully qualified name as their base name. For all other
641 // libraries, we use the first part of their filename. 641 // libraries, we use the first part of their filename.
642 name = library.hasLibraryName() 642 name = library.hasLibraryName()
643 ? name.substring(name.lastIndexOf('.') + 1) 643 ? name.substring(name.lastIndexOf('.') + 1)
644 : name.substring(0, name.indexOf('.')); 644 : name.substring(0, name.indexOf('.'));
645 } 645 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 String root = invocationName(selector); // Is already safe. 708 String root = invocationName(selector); // Is already safe.
709 709
710 if (classes.contains(backend.jsInterceptorClass)) { 710 if (classes.contains(backend.jsInterceptorClass)) {
711 // If the base Interceptor class is in the set of intercepted classes, 711 // If the base Interceptor class is in the set of intercepted classes,
712 // this is the most general specialization which uses the generic 712 // this is the most general specialization which uses the generic
713 // getInterceptor method. To keep the name short, we add '$' only to 713 // getInterceptor method. To keep the name short, we add '$' only to
714 // distinguish from global getters or setters; operators and methods can't 714 // distinguish from global getters or setters; operators and methods can't
715 // clash. 715 // clash.
716 // TODO(sra): Find a way to get the simple name when Object is not in the 716 // TODO(sra): Find a way to get the simple name when Object is not in the
717 // set of classes for most general variant, e.g. "$lt$n" could be "$lt". 717 // set of classes for most general variant, e.g. "$lt$n" could be "$lt".
718 if (selector.isGetter() || selector.isSetter()) root = '$root\$'; 718 if (selector.isGetter || selector.isSetter) root = '$root\$';
719 return getMappedGlobalName(root, ensureSafe: false); 719 return getMappedGlobalName(root, ensureSafe: false);
720 } else { 720 } else {
721 String suffix = getInterceptorSuffix(classes); 721 String suffix = getInterceptorSuffix(classes);
722 return getMappedGlobalName("$root\$$suffix", ensureSafe: false); 722 return getMappedGlobalName("$root\$$suffix", ensureSafe: false);
723 } 723 }
724 } 724 }
725 725
726 /// Returns the runtime name for [element]. The result is not safe as an id. 726 /// Returns the runtime name for [element]. The result is not safe as an id.
727 String getRuntimeTypeName(Element element) { 727 String getRuntimeTypeName(Element element) {
728 if (identical(element, compiler.dynamicClass)) return 'dynamic'; 728 if (identical(element, compiler.dynamicClass)) return 'dynamic';
729 return getNameForRti(element); 729 return getNameForRti(element);
730 } 730 }
731 731
732 /** 732 /**
733 * Returns a preferred JS-id for the given element. The returned id is 733 * Returns a preferred JS-id for the given element. The returned id is
734 * guaranteed to be a valid JS-id. Globals and static fields are furthermore 734 * guaranteed to be a valid JS-id. Globals and static fields are furthermore
735 * guaranteed to be unique. 735 * guaranteed to be unique.
736 * 736 *
737 * For accessing statics consider calling 737 * For accessing statics consider calling
738 * [isolateAccess] or [isolatePropertyAccess] instead. 738 * [isolateAccess] or [isolatePropertyAccess] instead.
739 */ 739 */
740 // TODO(ahe): This is an internal method to the Namer (and its subclasses) 740 // TODO(ahe): This is an internal method to the Namer (and its subclasses)
741 // and should not be call from outside. 741 // and should not be call from outside.
742 String getNameX(Element element) { 742 String getNameX(Element element) {
743 if (element.isInstanceMember()) { 743 if (element.isInstanceMember) {
744 if (element.kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY 744 if (element.kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY
745 || element.kind == ElementKind.FUNCTION) { 745 || element.kind == ElementKind.FUNCTION) {
746 return instanceMethodName(element); 746 return instanceMethodName(element);
747 } else if (element.kind == ElementKind.GETTER) { 747 } else if (element.kind == ElementKind.GETTER) {
748 return getterName(element); 748 return getterName(element);
749 } else if (element.kind == ElementKind.SETTER) { 749 } else if (element.kind == ElementKind.SETTER) {
750 return setterName(element); 750 return setterName(element);
751 } else if (element.kind == ElementKind.FIELD) { 751 } else if (element.kind == ElementKind.FIELD) {
752 compiler.internalError(element, 752 compiler.internalError(element,
753 'Use instanceFieldPropertyName or instanceFieldAccessorName.'); 753 'Use instanceFieldPropertyName or instanceFieldAccessorName.');
(...skipping 20 matching lines...) Expand all
774 if (kind == ElementKind.GENERATIVE_CONSTRUCTOR || 774 if (kind == ElementKind.GENERATIVE_CONSTRUCTOR ||
775 kind == ElementKind.FUNCTION || 775 kind == ElementKind.FUNCTION ||
776 kind == ElementKind.CLASS || 776 kind == ElementKind.CLASS ||
777 kind == ElementKind.FIELD || 777 kind == ElementKind.FIELD ||
778 kind == ElementKind.GETTER || 778 kind == ElementKind.GETTER ||
779 kind == ElementKind.SETTER || 779 kind == ElementKind.SETTER ||
780 kind == ElementKind.TYPEDEF || 780 kind == ElementKind.TYPEDEF ||
781 kind == ElementKind.LIBRARY) { 781 kind == ElementKind.LIBRARY) {
782 bool fixedName = false; 782 bool fixedName = false;
783 if (Elements.isInstanceField(element)) { 783 if (Elements.isInstanceField(element)) {
784 fixedName = element.hasFixedBackendName(); 784 fixedName = element.hasFixedBackendName;
785 } 785 }
786 String result = fixedName 786 String result = fixedName
787 ? guess 787 ? guess
788 : getFreshName(guess, usedGlobalNames, suggestedGlobalNames, 788 : getFreshName(guess, usedGlobalNames, suggestedGlobalNames,
789 ensureSafe: true); 789 ensureSafe: true);
790 globals[element] = result; 790 globals[element] = result;
791 return result; 791 return result;
792 } 792 }
793 compiler.internalError(element, 793 compiler.internalError(element,
794 'getName for unknown kind: ${element.kind}.'); 794 'getName for unknown kind: ${element.kind}.');
(...skipping 20 matching lines...) Expand all
815 /// to store only mutable static state in [currentIsolate], constants are 815 /// to store only mutable static state in [currentIsolate], constants are
816 /// stored in 'C', and functions, accessors, classes, etc. are stored in one 816 /// stored in 'C', and functions, accessors, classes, etc. are stored in one
817 /// of the other objects in [reservedGlobalObjectNames]. 817 /// of the other objects in [reservedGlobalObjectNames].
818 bool isPropertyOfCurrentIsolate(Element element) { 818 bool isPropertyOfCurrentIsolate(Element element) {
819 // TODO(ahe): Make sure this method's documentation is always true and 819 // TODO(ahe): Make sure this method's documentation is always true and
820 // remove the word "intend". 820 // remove the word "intend".
821 return 821 return
822 // TODO(ahe): Re-write these tests to be positive (so it only returns 822 // TODO(ahe): Re-write these tests to be positive (so it only returns
823 // true for static/top-level mutable fields). Right now, a number of 823 // true for static/top-level mutable fields). Right now, a number of
824 // other elements, such as bound closures also live in [currentIsolate]. 824 // other elements, such as bound closures also live in [currentIsolate].
825 !element.isAccessor() && 825 !element.isAccessor &&
826 !element.isClass() && 826 !element.isClass &&
827 !element.isConstructor() && 827 !element.isConstructor &&
828 !element.isFunction() && 828 !element.isFunction &&
829 !element.isLibrary(); 829 !element.isLibrary;
830 } 830 }
831 831
832 /// Returns [currentIsolate] or one of [reservedGlobalObjectNames]. 832 /// Returns [currentIsolate] or one of [reservedGlobalObjectNames].
833 String globalObjectFor(Element element) { 833 String globalObjectFor(Element element) {
834 if (isPropertyOfCurrentIsolate(element)) return currentIsolate; 834 if (isPropertyOfCurrentIsolate(element)) return currentIsolate;
835 LibraryElement library = element.getLibrary(); 835 LibraryElement library = element.library;
836 if (library == compiler.interceptorsLibrary) return 'J'; 836 if (library == compiler.interceptorsLibrary) return 'J';
837 if (library.isInternalLibrary) return 'H'; 837 if (library.isInternalLibrary) return 'H';
838 if (library.isPlatformLibrary) { 838 if (library.isPlatformLibrary) {
839 if ('${library.canonicalUri}' == 'dart:html') return 'W'; 839 if ('${library.canonicalUri}' == 'dart:html') return 'W';
840 return 'P'; 840 return 'P';
841 } 841 }
842 return userGlobalObjects[ 842 return userGlobalObjects[
843 library.getLibraryOrScriptName().hashCode % userGlobalObjects.length]; 843 library.getLibraryOrScriptName().hashCode % userGlobalObjects.length];
844 } 844 }
845 845
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 if (!first) { 1374 if (!first) {
1375 sb.write('_'); 1375 sb.write('_');
1376 } 1376 }
1377 sb.write('_'); 1377 sb.write('_');
1378 visit(link.head); 1378 visit(link.head);
1379 first = true; 1379 first = true;
1380 } 1380 }
1381 } 1381 }
1382 } 1382 }
1383 } 1383 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698