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

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

Issue 895063002: Add member type to model. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase 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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 assert(invariant(element, !element.isConstructor)); 469 assert(invariant(element, !element.isConstructor));
470 } 470 }
471 471
472 String callName = null; 472 String callName = null;
473 if (canTearOff) { 473 if (canTearOff) {
474 Selector callSelector = 474 Selector callSelector =
475 new Selector.fromElement(element).toCallSelector(); 475 new Selector.fromElement(element).toCallSelector();
476 callName = namer.invocationName(callSelector); 476 callName = namer.invocationName(callSelector);
477 } 477 }
478 478
479 DartType memberType;
480 if (element.isGenerativeConstructorBody) {
481 // TODO(herhut): Why does this need to be normalized away? We never need
482 // this information anyway as they cannot be torn off or
483 // reflected.
484 var body = element;
485 memberType = body.constructor.type;
486 } else {
487 memberType = element.type;
488 }
489
479 return new InstanceMethod(element, name, code, 490 return new InstanceMethod(element, name, code,
480 _generateParameterStubs(element, canTearOff), callName, 491 _generateParameterStubs(element, canTearOff), callName, memberType,
481 needsTearOff: canTearOff, tearOffName: tearOffName, 492 needsTearOff: canTearOff, tearOffName: tearOffName,
482 isClosure: isClosure, aliasName: aliasName, 493 isClosure: isClosure, aliasName: aliasName,
483 canBeApplied: canBeApplied, canBeReflected: canBeReflected); 494 canBeApplied: canBeApplied, canBeReflected: canBeReflected);
484 } 495 }
485 496
486 List<ParameterStubMethod> _generateParameterStubs(FunctionElement element, 497 List<ParameterStubMethod> _generateParameterStubs(FunctionElement element,
487 bool canTearOff) { 498 bool canTearOff) {
488 499
489 if (!_methodNeedsStubs(element)) return const <ParameterStubMethod>[]; 500 if (!_methodNeedsStubs(element)) return const <ParameterStubMethod>[];
490 501
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 String callName = null; 623 String callName = null;
613 if (needsTearOff) { 624 if (needsTearOff) {
614 Selector callSelector = 625 Selector callSelector =
615 new Selector.fromElement(element).toCallSelector(); 626 new Selector.fromElement(element).toCallSelector();
616 callName = namer.invocationName(callSelector); 627 callName = namer.invocationName(callSelector);
617 } 628 }
618 629
619 return new StaticDartMethod(element, 630 return new StaticDartMethod(element,
620 name, _registry.registerHolder(holder), code, 631 name, _registry.registerHolder(holder), code,
621 _generateParameterStubs(element, needsTearOff), 632 _generateParameterStubs(element, needsTearOff),
622 callName, 633 callName, element.type,
623 needsTearOff: needsTearOff, 634 needsTearOff: needsTearOff,
624 tearOffName: tearOffName, 635 tearOffName: tearOffName,
625 canBeApplied: canBeApplied, 636 canBeApplied: canBeApplied,
626 canBeReflected: canBeReflected); 637 canBeReflected: canBeReflected);
627 } 638 }
628 639
629 void _registerConstants(OutputUnit outputUnit, 640 void _registerConstants(OutputUnit outputUnit,
630 Iterable<ConstantValue> constantValues) { 641 Iterable<ConstantValue> constantValues) {
631 // `constantValues` is null if an outputUnit doesn't contain any constants. 642 // `constantValues` is null if an outputUnit doesn't contain any constants.
632 if (constantValues == null) return; 643 if (constantValues == null) return;
633 for (ConstantValue constantValue in constantValues) { 644 for (ConstantValue constantValue in constantValues) {
634 _registry.registerConstant(outputUnit, constantValue); 645 _registry.registerConstant(outputUnit, constantValue);
635 assert(!_constants.containsKey(constantValue)); 646 assert(!_constants.containsKey(constantValue));
636 String name = namer.constantName(constantValue); 647 String name = namer.constantName(constantValue);
637 String constantObject = namer.globalObjectForConstant(constantValue); 648 String constantObject = namer.globalObjectForConstant(constantValue);
638 Holder holder = _registry.registerHolder(constantObject); 649 Holder holder = _registry.registerHolder(constantObject);
639 Constant constant = new Constant(name, holder, constantValue); 650 Constant constant = new Constant(name, holder, constantValue);
640 _constants[constantValue] = constant; 651 _constants[constantValue] = constant;
641 } 652 }
642 } 653 }
643 } 654 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698