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

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

Issue 885783005: Revert "Move reflection support out of model." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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) 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 selector.argumentCount, selector.namedArguments); 227 selector.argumentCount, selector.namedArguments);
228 if (!selector.appliesUnnamed(member, compiler.world)) continue; 228 if (!selector.appliesUnnamed(member, compiler.world)) continue;
229 if (untypedSelectors.add(selector)) { 229 if (untypedSelectors.add(selector)) {
230 addParameterStub(member, selector, defineStub); 230 addParameterStub(member, selector, defineStub);
231 } 231 }
232 } 232 }
233 } 233 }
234 } 234 }
235 } 235 }
236 236
237 String _tearOffNameForMember(FunctionElement member) {
238 if (member.isInstanceMember) {
239 return namer.getterName(member);
240 } else {
241 return namer.getStaticClosureName(member);
242 }
243 }
244
245 void addMemberMethod(DartMethod method, ClassBuilder builder) { 237 void addMemberMethod(DartMethod method, ClassBuilder builder) {
246 final FunctionElement member = method.element; 238 final FunctionElement member = method.element;
247 String name = method.name; 239 String name = method.name;
248 final FunctionSignature parameters = member.functionSignature; 240 final FunctionSignature parameters = member.functionSignature;
249 jsAst.Expression code = method.code; 241 jsAst.Expression code = method.code;
250 final bool needsStubs = method.needsStubs; 242 final bool needsStubs = method.needsStubs;
243 final bool canTearOff = method.needsTearOff;
244 final String tearOffName = method.tearOffName;
245 final bool canBeReflected = method.canBeReflected;
251 final bool canBeApplied = method.canBeApplied; 246 final bool canBeApplied = method.canBeApplied;
252 bool canTearOff = method.needsTearOff;
253 String tearOffName = method.tearOffName;
254 final bool isClosure = method is InstanceMethod && method.isClosure; 247 final bool isClosure = method is InstanceMethod && method.isClosure;
255 final bool hasSuperAlias = method is InstanceMethod && method.hasSuperAlias; 248 final bool hasSuperAlias = method is InstanceMethod && method.hasSuperAlias;
256 249
257 bool canBeReflected = backend.isAccessibleByReflection(member);
258 // During incremental compilation, we have to assume that reflection
259 // *might* get enabled.
260 if (compiler.hasIncrementalSupport) canBeReflected = true;
261
262 if (canBeReflected) {
263 // Patch the effects of reflection into the received information.
264 bool isNotApplyTarget = member.isConstructor ||
265 member.isAccessor ||
266 member.isOperator ||
267 isClosure;
268 canTearOff = canTearOff || (canBeReflected && !isNotApplyTarget);
269 tearOffName = tearOffName != null ? tearOffName
270 : _tearOffNameForMember(member);
271 }
272
273 final bool needStructuredInfo = 250 final bool needStructuredInfo =
274 canTearOff || canBeReflected || canBeApplied || hasSuperAlias; 251 canTearOff || canBeReflected || canBeApplied || hasSuperAlias;
275 252
276 emitter.interceptorEmitter.recordMangledNameOfMemberMethod(member, name); 253 emitter.interceptorEmitter.recordMangledNameOfMemberMethod(member, name);
277 254
278 if (!needStructuredInfo) { 255 if (!needStructuredInfo) {
279 compiler.dumpInfoTask.registerElementAst(member, 256 compiler.dumpInfoTask.registerElementAst(member,
280 builder.addProperty(name, code)); 257 builder.addProperty(name, code));
281 if (needsStubs) { 258 if (needsStubs) {
282 addParameterStubs( 259 addParameterStubs(
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 jsAst.ArrayInitializer arrayInit = 428 jsAst.ArrayInitializer arrayInit =
452 new jsAst.ArrayInitializer(expressions.toList()); 429 new jsAst.ArrayInitializer(expressions.toList());
453 compiler.dumpInfoTask.registerElementAst(member, 430 compiler.dumpInfoTask.registerElementAst(member,
454 builder.addProperty(name, arrayInit)); 431 builder.addProperty(name, arrayInit));
455 } 432 }
456 433
457 void addMemberField(Field field, ClassBuilder builder) { 434 void addMemberField(Field field, ClassBuilder builder) {
458 // For now, do nothing. 435 // For now, do nothing.
459 } 436 }
460 } 437 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/model.dart ('k') | pkg/compiler/lib/src/js_emitter/program_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698