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

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

Issue 1383483006: Extract DiagnosticReporter implementation from Compiler. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fixes after rebase. Created 5 years, 2 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 7 import 'dart:collection' show
8 IterableMixin; 8 IterableMixin;
9 9
10 import '../compiler.dart' show 10 import '../compiler.dart' show
11 Compiler; 11 Compiler;
12 import '../constants/constant_system.dart'; 12 import '../constants/constant_system.dart';
13 import '../constants/expressions.dart'; 13 import '../constants/expressions.dart';
14 import '../dart_types.dart'; 14 import '../dart_types.dart';
15 import '../diagnostics/diagnostic_listener.dart' show
16 DiagnosticReporter;
15 import '../diagnostics/spannable.dart' show 17 import '../diagnostics/spannable.dart' show
16 Spannable; 18 Spannable;
17 import '../elements/elements.dart'; 19 import '../elements/elements.dart';
18 import '../resolution/operators.dart'; 20 import '../resolution/operators.dart';
19 import '../resolution/semantic_visitor.dart'; 21 import '../resolution/semantic_visitor.dart';
20 import '../resolution/send_resolver.dart' show 22 import '../resolution/send_resolver.dart' show
21 SendResolverMixin; 23 SendResolverMixin;
22 import '../resolution/tree_elements.dart' show 24 import '../resolution/tree_elements.dart' show
23 TreeElements; 25 TreeElements;
24 import '../tree/tree.dart'; 26 import '../tree/tree.dart';
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 this.elements = analyzedElement.resolvedAst.elements { 744 this.elements = analyzedElement.resolvedAst.elements {
743 if (handler != null) return; 745 if (handler != null) return;
744 Node node = analyzedElement.node; 746 Node node = analyzedElement.node;
745 FieldInitializationScope<T> fieldScope = 747 FieldInitializationScope<T> fieldScope =
746 analyzedElement.isGenerativeConstructor 748 analyzedElement.isGenerativeConstructor
747 ? new FieldInitializationScope<T>(types) 749 ? new FieldInitializationScope<T>(types)
748 : null; 750 : null;
749 locals = new LocalsHandler<T>(inferrer, types, compiler, node, fieldScope); 751 locals = new LocalsHandler<T>(inferrer, types, compiler, node, fieldScope);
750 } 752 }
751 753
754 DiagnosticReporter get reporter => compiler.reporter;
755
752 @override 756 @override
753 SemanticSendVisitor get sendVisitor => this; 757 SemanticSendVisitor get sendVisitor => this;
754 758
755 @override 759 @override
756 T apply(Node node, _) => visit(node); 760 T apply(Node node, _) => visit(node);
757 761
758 T handleSendSet(SendSet node); 762 T handleSendSet(SendSet node);
759 763
760 T handleDynamicInvoke(Send node); 764 T handleDynamicInvoke(Send node);
761 765
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 T visitContinueStatement(ContinueStatement node) { 1460 T visitContinueStatement(ContinueStatement node) {
1457 JumpTarget target = elements.getTargetOf(node); 1461 JumpTarget target = elements.getTargetOf(node);
1458 locals.seenBreakOrContinue = true; 1462 locals.seenBreakOrContinue = true;
1459 // Do a deep-copy of the locals, because the code following the 1463 // Do a deep-copy of the locals, because the code following the
1460 // continue will change them. 1464 // continue will change them.
1461 continuesFor[target].add(new LocalsHandler<T>.deepCopyOf(locals)); 1465 continuesFor[target].add(new LocalsHandler<T>.deepCopyOf(locals));
1462 return null; 1466 return null;
1463 } 1467 }
1464 1468
1465 internalError(Spannable node, String reason) { 1469 internalError(Spannable node, String reason) {
1466 compiler.internalError(node, reason); 1470 reporter.internalError(node, reason);
1467 } 1471 }
1468 1472
1469 T visitSwitchStatement(SwitchStatement node) { 1473 T visitSwitchStatement(SwitchStatement node) {
1470 visit(node.parenthesizedExpression); 1474 visit(node.parenthesizedExpression);
1471 1475
1472 setupBreaksAndContinues(elements.getTargetDefinition(node)); 1476 setupBreaksAndContinues(elements.getTargetDefinition(node));
1473 if (Elements.switchStatementHasContinue(node, elements)) { 1477 if (Elements.switchStatementHasContinue(node, elements)) {
1474 void forEachLabeledCase(void action(JumpTarget target)) { 1478 void forEachLabeledCase(void action(JumpTarget target)) {
1475 for (SwitchCase switchCase in node.cases) { 1479 for (SwitchCase switchCase in node.cases) {
1476 for (Node labelOrCase in switchCase.labelsAndCases) { 1480 for (Node labelOrCase in switchCase.labelsAndCases) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1534 return type; 1538 return type;
1535 } 1539 }
1536 1540
1537 T visitCascade(Cascade node) { 1541 T visitCascade(Cascade node) {
1538 // Ignore the result of the cascade send and return the type of the cascade 1542 // Ignore the result of the cascade send and return the type of the cascade
1539 // receiver. 1543 // receiver.
1540 visit(node.expression); 1544 visit(node.expression);
1541 return cascadeReceiverStack.removeLast(); 1545 return cascadeReceiverStack.removeLast();
1542 } 1546 }
1543 } 1547 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/helpers/trace.dart ('k') | pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698