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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/old_emitter/container_builder.dart

Issue 779593002: Move elementAccess() from namer to emitter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 /// This class should morph into something that makes it easy to build 7 /// This class should morph into something that makes it easy to build
8 /// JavaScript representations of libraries, class-sides, and instance-sides. 8 /// JavaScript representations of libraries, class-sides, and instance-sides.
9 /// Initially, it is just a placeholder for code that is moved from 9 /// Initially, it is just a placeholder for code that is moved from
10 /// [CodeEmitterTask]. 10 /// [CodeEmitterTask].
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } else if (member.isInstanceMember) { 119 } else if (member.isInstanceMember) {
120 if (needsSuperGetter(member)) { 120 if (needsSuperGetter(member)) {
121 ClassElement superClass = member.enclosingClass; 121 ClassElement superClass = member.enclosingClass;
122 String methodName = namer.getNameOfInstanceMember(member); 122 String methodName = namer.getNameOfInstanceMember(member);
123 // When redirecting, we must ensure that we don't end up in a subclass. 123 // When redirecting, we must ensure that we don't end up in a subclass.
124 // We thus can't just invoke `this.foo$1.call(filledInArguments)`. 124 // We thus can't just invoke `this.foo$1.call(filledInArguments)`.
125 // Instead we need to call the statically resolved target. 125 // Instead we need to call the statically resolved target.
126 // `<class>.prototype.bar$1.call(this, argument0, ...)`. 126 // `<class>.prototype.bar$1.call(this, argument0, ...)`.
127 body = js.statement( 127 body = js.statement(
128 'return #.prototype.#.call(this, #);', 128 'return #.prototype.#.call(this, #);',
129 [backend.namer.elementAccess(superClass), methodName, 129 [backend.emitter.classAccess(superClass), methodName,
130 argumentsBuffer]); 130 argumentsBuffer]);
131 } else { 131 } else {
132 body = js.statement( 132 body = js.statement(
133 'return this.#(#);', 133 'return this.#(#);',
134 [namer.getNameOfInstanceMember(member), argumentsBuffer]); 134 [namer.getNameOfInstanceMember(member), argumentsBuffer]);
135 } 135 }
136 } else { 136 } else {
137 body = js.statement('return #(#)', 137 body = js.statement('return #(#)',
138 [namer.elementAccess(member), argumentsBuffer]); 138 [emitter.staticFunctionAccess(member), argumentsBuffer]);
139 } 139 }
140 140
141 jsAst.Fun function = js('function(#) { #; }', [parametersBuffer, body]); 141 jsAst.Fun function = js('function(#) { #; }', [parametersBuffer, body]);
142 142
143 addStub(selector, function); 143 addStub(selector, function);
144 } 144 }
145 145
146 void addParameterStubs(FunctionElement member, AddStubFunction defineStub, 146 void addParameterStubs(FunctionElement member, AddStubFunction defineStub,
147 [bool canTearOff = false]) { 147 [bool canTearOff = false]) {
148 if (member.enclosingElement.isClosure) { 148 if (member.enclosingElement.isClosure) {
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 assert(needsStubs != null); 662 assert(needsStubs != null);
663 assert(canTearOff != null); 663 assert(canTearOff != null);
664 assert(isClosure != null); 664 assert(isClosure != null);
665 assert(tearOffName != null || !canTearOff); 665 assert(tearOffName != null || !canTearOff);
666 assert(canBeReflected != null); 666 assert(canBeReflected != null);
667 assert(canBeApplied != null); 667 assert(canBeApplied != null);
668 assert(hasSuperAlias != null); 668 assert(hasSuperAlias != null);
669 assert(needStructuredInfo != null); 669 assert(needStructuredInfo != null);
670 } 670 }
671 } 671 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698