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

Side by Side Diff: pkg/dart2js_incremental/lib/library_updater.dart

Issue 753113002: Encode super calls via extra properties on prototypes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comments Created 6 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 dart2js_incremental.library_updater; 5 library dart2js_incremental.library_updater;
6 6
7 import 'dart:async' show 7 import 'dart:async' show
8 Future; 8 Future;
9 9
10 import 'dart:convert' show 10 import 'dart:convert' show
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 compiler.internalError(element, '${element.runtimeType}'); 599 compiler.internalError(element, '${element.runtimeType}');
600 } 600 }
601 String name = info.name; 601 String name = info.name;
602 jsAst.Node function = info.code; 602 jsAst.Node function = info.code;
603 List<jsAst.Statement> statements = <jsAst.Statement>[]; 603 List<jsAst.Statement> statements = <jsAst.Statement>[];
604 if (element.isInstanceMember) { 604 if (element.isInstanceMember) {
605 jsAst.Node elementAccess = namer.elementAccess(element.enclosingClass); 605 jsAst.Node elementAccess = namer.elementAccess(element.enclosingClass);
606 statements.add( 606 statements.add(
607 js.statement('#.prototype.# = f', [elementAccess, name])); 607 js.statement('#.prototype.# = f', [elementAccess, name]));
608 608
609 // TODO(ahe): Restore when isAliasedSuperMember is restored. 609 if (backend.isAliasedSuperMember(element)) {
610 // if (backend.isAliasedSuperMember(element)) { 610 String superName = namer.getNameOfAliasedSuperMember(element);
611 // String superName = namer.getNameOfAliasedSuperMember(element); 611 statements.add(
612 // statements.add( 612 js.statement('#.prototype.# = f', [elementAccess, superName]));
613 // js.statement('#.prototype.# = f', [elementAccess, superName])); 613 }
614 // }
615 } else { 614 } else {
616 jsAst.Node elementAccess = namer.elementAccess(element); 615 jsAst.Node elementAccess = namer.elementAccess(element);
617 jsAst.Expression globalFunctionsAccess = 616 jsAst.Expression globalFunctionsAccess =
618 emitter.generateEmbeddedGlobalAccess(embeddedNames.GLOBAL_FUNCTIONS); 617 emitter.generateEmbeddedGlobalAccess(embeddedNames.GLOBAL_FUNCTIONS);
619 statements.add( 618 statements.add(
620 js.statement( 619 js.statement(
621 '#.# = # = f', 620 '#.# = # = f',
622 [globalFunctionsAccess, name, elementAccess])); 621 [globalFunctionsAccess, name, elementAccess]));
623 if (info.canTearOff) { 622 if (info.canTearOff) {
624 String globalName = namer.globalObjectFor(element); 623 String globalName = namer.globalObjectFor(element);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 783
785 PartialFunctionElement get after => null; 784 PartialFunctionElement get after => null;
786 785
787 void captureState() { 786 void captureState() {
788 if (wasStateCaptured) throw "captureState was called twice."; 787 if (wasStateCaptured) throw "captureState was called twice.";
789 wasStateCaptured = true; 788 wasStateCaptured = true;
790 789
791 if (element.isInstanceMember) { 790 if (element.isInstanceMember) {
792 elementAccess = namer.elementAccess(element.enclosingClass); 791 elementAccess = namer.elementAccess(element.enclosingClass);
793 name = namer.getNameOfMember(element); 792 name = namer.getNameOfMember(element);
794 // TODO(ahe): Restore when isAliasedSuperMember is restored. 793 if (backend.isAliasedSuperMember(element)) {
795 // if (backend.isAliasedSuperMember(element)) { 794 superName = namer.getNameOfAliasedSuperMember(element);
796 // superName = namer.getNameOfAliasedSuperMember(element); 795 }
797 // }
798 } else { 796 } else {
799 elementAccess = namer.elementAccess(element); 797 elementAccess = namer.elementAccess(element);
800 } 798 }
801 } 799 }
802 800
803 PartialFunctionElement apply() { 801 PartialFunctionElement apply() {
804 if (!wasStateCaptured) throw "captureState must be called before apply."; 802 if (!wasStateCaptured) throw "captureState must be called before apply.";
805 removeFromEnclosing(); 803 removeFromEnclosing();
806 reuseElement(); 804 reuseElement();
807 return null; 805 return null;
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 1080
1083 ClassEmitter get classEmitter => backend.emitter.oldEmitter.classEmitter; 1081 ClassEmitter get classEmitter => backend.emitter.oldEmitter.classEmitter;
1084 1082
1085 List<String> computeFields(ClassElement cls) { 1083 List<String> computeFields(ClassElement cls) {
1086 // TODO(ahe): Rewrite for new emitter. 1084 // TODO(ahe): Rewrite for new emitter.
1087 ClassBuilder builder = new ClassBuilder(cls, namer); 1085 ClassBuilder builder = new ClassBuilder(cls, namer);
1088 classEmitter.emitFields(cls, builder, ""); 1086 classEmitter.emitFields(cls, builder, "");
1089 return builder.fields; 1087 return builder.fields;
1090 } 1088 }
1091 } 1089 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698