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

Side by Side Diff: pkg/compiler/lib/src/world.dart

Issue 1383483006: Extract DiagnosticReporter implementation from Compiler. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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.world; 5 library dart2js.world;
6 6
7 import 'closure.dart' show 7 import 'closure.dart' show
8 SynthesizedCallMethodElementX; 8 SynthesizedCallMethodElementX;
9 import 'common/backend_api.dart' show 9 import 'common/backend_api.dart' show
10 Backend; 10 Backend;
11 import 'common/registry.dart' show 11 import 'common/registry.dart' show
12 Registry; 12 Registry;
13 import 'compiler.dart' show 13 import 'compiler.dart' show
14 Compiler; 14 Compiler;
15 import 'dart_types.dart'; 15 import 'dart_types.dart';
16 import 'diagnostics/diagnostic_listener.dart' show
17 DiagnosticReporter;
16 import 'diagnostics/invariant.dart' show 18 import 'diagnostics/invariant.dart' show
17 invariant; 19 invariant;
18 import 'elements/elements.dart' show 20 import 'elements/elements.dart' show
19 ClassElement, 21 ClassElement,
20 Element, 22 Element,
21 FunctionElement, 23 FunctionElement,
22 MixinApplicationElement, 24 MixinApplicationElement,
23 TypedefElement, 25 TypedefElement,
24 VariableElement; 26 VariableElement;
25 import 'ordered_typeset.dart'; 27 import 'ordered_typeset.dart';
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 412
411 Set<ClassElement> typesImplementedBySubclassesOf(ClassElement cls) { 413 Set<ClassElement> typesImplementedBySubclassesOf(ClassElement cls) {
412 return _typesImplementedBySubclasses[cls.declaration]; 414 return _typesImplementedBySubclasses[cls.declaration];
413 } 415 }
414 416
415 World(Compiler compiler) 417 World(Compiler compiler)
416 : allFunctions = new FunctionSet(compiler), 418 : allFunctions = new FunctionSet(compiler),
417 this.compiler = compiler, 419 this.compiler = compiler,
418 alreadyPopulated = compiler.cacheStrategy.newSet(); 420 alreadyPopulated = compiler.cacheStrategy.newSet();
419 421
422 DiagnosticReporter get reporter => compiler.reporter;
423
420 /// Called to add [cls] to the set of known classes. 424 /// Called to add [cls] to the set of known classes.
421 /// 425 ///
422 /// This ensures that class hierarchy queries can be performed on [cls] and 426 /// This ensures that class hierarchy queries can be performed on [cls] and
423 /// classes that extend or implement it. 427 /// classes that extend or implement it.
424 void registerClass(ClassElement cls) { 428 void registerClass(ClassElement cls) {
425 _ensureClassSet(cls); 429 _ensureClassSet(cls);
426 } 430 }
427 431
428 /// Returns [ClassHierarchyNode] for [cls] used to model the class hierarchies 432 /// Returns [ClassHierarchyNode] for [cls] used to model the class hierarchies
429 /// of known classes. 433 /// of known classes.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 cls.superclass, indirectlyInstantiated: true); 497 cls.superclass, indirectlyInstantiated: true);
494 } 498 }
495 } 499 }
496 500
497 void addSubtypes(ClassElement cls) { 501 void addSubtypes(ClassElement cls) {
498 if (compiler.hasIncrementalSupport && !alreadyPopulated.add(cls)) { 502 if (compiler.hasIncrementalSupport && !alreadyPopulated.add(cls)) {
499 return; 503 return;
500 } 504 }
501 assert(cls.isDeclaration); 505 assert(cls.isDeclaration);
502 if (!cls.isResolved) { 506 if (!cls.isResolved) {
503 compiler.internalError(cls, 'Class "${cls.name}" is not resolved.'); 507 reporter.internalError(cls, 'Class "${cls.name}" is not resolved.');
504 } 508 }
505 509
506 updateClassHierarchyNodeForClass(cls, directlyInstantiated: true); 510 updateClassHierarchyNodeForClass(cls, directlyInstantiated: true);
507 511
508 // Walk through the superclasses, and record the types 512 // Walk through the superclasses, and record the types
509 // implemented by that type on the superclasses. 513 // implemented by that type on the superclasses.
510 ClassElement superclass = cls.superclass; 514 ClassElement superclass = cls.superclass;
511 while (superclass != null) { 515 while (superclass != null) {
512 Set<Element> typesImplementedBySubclassesOfCls = 516 Set<Element> typesImplementedBySubclassesOfCls =
513 _typesImplementedBySubclasses.putIfAbsent( 517 _typesImplementedBySubclasses.putIfAbsent(
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 // function expressions's element. 679 // function expressions's element.
676 // TODO(herhut): Generate classes for function expressions earlier. 680 // TODO(herhut): Generate classes for function expressions earlier.
677 if (element is SynthesizedCallMethodElementX) { 681 if (element is SynthesizedCallMethodElementX) {
678 return getMightBePassedToApply(element.expression); 682 return getMightBePassedToApply(element.expression);
679 } 683 }
680 return functionsThatMightBePassedToApply.contains(element); 684 return functionsThatMightBePassedToApply.contains(element);
681 } 685 }
682 686
683 bool get hasClosedWorldAssumption => !compiler.hasIncrementalSupport; 687 bool get hasClosedWorldAssumption => !compiler.hasIncrementalSupport;
684 } 688 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698