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

Side by Side Diff: pkg/compiler/lib/src/inferrer/inferrer_visitor.dart

Issue 1881013002: Expand ResolvedAst to handle synthetic constructors. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments + fix test, cps and compilation units for injected members. Created 4 years, 8 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
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 library inferrer_visitor; 5 library inferrer_visitor;
6 6
7 import 'dart:collection' show IterableMixin; 7 import 'dart:collection' show IterableMixin;
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 CompoundBulkMixin<T, dynamic>, 698 CompoundBulkMixin<T, dynamic>,
699 SetIfNullBulkMixin<T, dynamic>, 699 SetIfNullBulkMixin<T, dynamic>,
700 PrefixBulkMixin<T, dynamic>, 700 PrefixBulkMixin<T, dynamic>,
701 PostfixBulkMixin<T, dynamic>, 701 PostfixBulkMixin<T, dynamic>,
702 ErrorBulkMixin<T, dynamic>, 702 ErrorBulkMixin<T, dynamic>,
703 NewBulkMixin<T, dynamic>, 703 NewBulkMixin<T, dynamic>,
704 SetBulkMixin<T, dynamic> 704 SetBulkMixin<T, dynamic>
705 implements SemanticSendVisitor<T, dynamic> { 705 implements SemanticSendVisitor<T, dynamic> {
706 final Compiler compiler; 706 final Compiler compiler;
707 final AstElement analyzedElement; 707 final AstElement analyzedElement;
708 final ResolvedAst resolvedAst;
708 final TypeSystem<T> types; 709 final TypeSystem<T> types;
709 final E inferrer; 710 final E inferrer;
710 final Map<JumpTarget, List<LocalsHandler<T>>> breaksFor = 711 final Map<JumpTarget, List<LocalsHandler<T>>> breaksFor =
711 new Map<JumpTarget, List<LocalsHandler<T>>>(); 712 new Map<JumpTarget, List<LocalsHandler<T>>>();
712 final Map<JumpTarget, List<LocalsHandler>> continuesFor = 713 final Map<JumpTarget, List<LocalsHandler>> continuesFor =
713 new Map<JumpTarget, List<LocalsHandler<T>>>(); 714 new Map<JumpTarget, List<LocalsHandler<T>>>();
714 LocalsHandler<T> locals; 715 LocalsHandler<T> locals;
715 final List<T> cascadeReceiverStack = new List<T>(); 716 final List<T> cascadeReceiverStack = new List<T>();
716 final TreeElements elements; 717
718 TreeElements get elements => resolvedAst.elements;
717 719
718 bool accumulateIsChecks = false; 720 bool accumulateIsChecks = false;
719 bool conditionIsSimple = false; 721 bool conditionIsSimple = false;
720 List<Send> isChecks; 722 List<Send> isChecks;
721 int loopLevel = 0; 723 int loopLevel = 0;
722 724
723 bool get inLoop => loopLevel > 0; 725 bool get inLoop => loopLevel > 0;
724 bool get isThisExposed { 726 bool get isThisExposed {
725 return analyzedElement.isGenerativeConstructor 727 return analyzedElement.isGenerativeConstructor
726 ? locals.fieldScope.isThisExposed 728 ? locals.fieldScope.isThisExposed
727 : true; 729 : true;
728 } 730 }
729 731
730 void set isThisExposed(value) { 732 void set isThisExposed(value) {
731 if (analyzedElement.isGenerativeConstructor) { 733 if (analyzedElement.isGenerativeConstructor) {
732 locals.fieldScope.isThisExposed = value; 734 locals.fieldScope.isThisExposed = value;
733 } 735 }
734 } 736 }
735 737
736 InferrerVisitor( 738 InferrerVisitor(AstElement analyzedElement, this.resolvedAst, this.inferrer,
737 AstElement analyzedElement, this.inferrer, this.types, this.compiler, 739 this.types, this.compiler,
738 [LocalsHandler<T> handler]) 740 [LocalsHandler<T> handler])
739 : this.analyzedElement = analyzedElement, 741 : this.analyzedElement = analyzedElement,
740 this.locals = handler, 742 this.locals = handler {
741 this.elements = analyzedElement.resolvedAst.elements {
742 if (handler != null) return; 743 if (handler != null) return;
743 Node node = analyzedElement.node; 744 Node node = analyzedElement.node;
744 FieldInitializationScope<T> fieldScope = 745 FieldInitializationScope<T> fieldScope =
745 analyzedElement.isGenerativeConstructor 746 analyzedElement.isGenerativeConstructor
746 ? new FieldInitializationScope<T>(types) 747 ? new FieldInitializationScope<T>(types)
747 : null; 748 : null;
748 locals = new LocalsHandler<T>(inferrer, types, compiler, node, fieldScope); 749 locals = new LocalsHandler<T>(inferrer, types, compiler, node, fieldScope);
749 } 750 }
750 751
751 DiagnosticReporter get reporter => compiler.reporter; 752 DiagnosticReporter get reporter => compiler.reporter;
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 return type; 1484 return type;
1484 } 1485 }
1485 1486
1486 T visitCascade(Cascade node) { 1487 T visitCascade(Cascade node) {
1487 // Ignore the result of the cascade send and return the type of the cascade 1488 // Ignore the result of the cascade send and return the type of the cascade
1488 // receiver. 1489 // receiver.
1489 visit(node.expression); 1490 visit(node.expression);
1490 return cascadeReceiverStack.removeLast(); 1491 return cascadeReceiverStack.removeLast();
1491 } 1492 }
1492 } 1493 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/id_generator.dart ('k') | pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698