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

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

Issue 891743002: Add support for super aliases to new emitter. (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) 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.js_emitter.program_builder; 5 library dart2js.js_emitter.program_builder;
6 6
7 import 'js_emitter.dart' show computeMixinClass; 7 import 'js_emitter.dart' show computeMixinClass;
8 import 'model.dart'; 8 import 'model.dart';
9 9
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 if (code == null) return null; 420 if (code == null) return null;
421 421
422 bool canTearOff = false; 422 bool canTearOff = false;
423 String tearOffName; 423 String tearOffName;
424 bool isClosure = false; 424 bool isClosure = false;
425 bool isNotApplyTarget = !element.isFunction || element.isAccessor; 425 bool isNotApplyTarget = !element.isFunction || element.isAccessor;
426 426
427 final bool needsStubs = _methodNeedsStubs(element); 427 final bool needsStubs = _methodNeedsStubs(element);
428 final bool canBeReflected = _methodCanBeReflected(element); 428 final bool canBeReflected = _methodCanBeReflected(element);
429 final bool canBeApplied = _methodCanBeApplied(element); 429 final bool canBeApplied = _methodCanBeApplied(element);
430 final bool hasSuperAlias = backend.isAliasedSuperMember(element); 430 String superAlias;
431 if (backend.isAliasedSuperMember(element)) {
432 superAlias = namer.getNameOfAliasedSuperMember(element);
433 }
431 434
432 if (isNotApplyTarget) { 435 if (isNotApplyTarget) {
433 canTearOff = false; 436 canTearOff = false;
434 } else { 437 } else {
435 if (element.enclosingClass.isClosure) { 438 if (element.enclosingClass.isClosure) {
436 canTearOff = false; 439 canTearOff = false;
437 isClosure = true; 440 isClosure = true;
438 } else { 441 } else {
439 // Careful with operators. 442 // Careful with operators.
440 canTearOff = universe.hasInvokedGetter(element, _compiler.world) || 443 canTearOff = universe.hasInvokedGetter(element, _compiler.world) ||
(...skipping 18 matching lines...) Expand all
459 String callName = null; 462 String callName = null;
460 if (canTearOff) { 463 if (canTearOff) {
461 Selector callSelector = 464 Selector callSelector =
462 new Selector.fromElement(element).toCallSelector(); 465 new Selector.fromElement(element).toCallSelector();
463 callName = namer.invocationName(callSelector); 466 callName = namer.invocationName(callSelector);
464 } 467 }
465 468
466 return new InstanceMethod(element, name, code, adapters, callName, 469 return new InstanceMethod(element, name, code, adapters, callName,
467 needsTearOff: canTearOff, 470 needsTearOff: canTearOff,
468 tearOffName: tearOffName, isClosure: isClosure, 471 tearOffName: tearOffName, isClosure: isClosure,
469 hasSuperAlias: hasSuperAlias, canBeApplied: canBeApplied, 472 superAlias: superAlias, canBeApplied: canBeApplied,
470 canBeReflected: canBeReflected, needsStubs: needsStubs); 473 canBeReflected: canBeReflected, needsStubs: needsStubs);
471 } 474 }
472 475
473 /// Builds a stub method. 476 /// Builds a stub method.
474 /// 477 ///
475 /// Stub methods may have an element that can be used for code-size 478 /// Stub methods may have an element that can be used for code-size
476 /// attribution. 479 /// attribution.
477 Method _buildStubMethod(String name, js.Expression code, 480 Method _buildStubMethod(String name, js.Expression code,
478 {Element element}) { 481 {Element element}) {
479 return new StubMethod(name, code, element: element); 482 return new StubMethod(name, code, element: element);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 _registry.registerConstant(outputUnit, constantValue); 621 _registry.registerConstant(outputUnit, constantValue);
619 assert(!_constants.containsKey(constantValue)); 622 assert(!_constants.containsKey(constantValue));
620 String name = namer.constantName(constantValue); 623 String name = namer.constantName(constantValue);
621 String constantObject = namer.globalObjectForConstant(constantValue); 624 String constantObject = namer.globalObjectForConstant(constantValue);
622 Holder holder = _registry.registerHolder(constantObject); 625 Holder holder = _registry.registerHolder(constantObject);
623 Constant constant = new Constant(name, holder, constantValue); 626 Constant constant = new Constant(name, holder, constantValue);
624 _constants[constantValue] = constant; 627 _constants[constantValue] = constant;
625 } 628 }
626 } 629 }
627 } 630 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698