OLD | NEW |
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.typechecker; | 5 library dart2js.typechecker; |
6 | 6 |
7 import 'common/names.dart' show Identifiers; | 7 import 'common/names.dart' show Identifiers; |
8 import 'common/resolution.dart' show Resolution; | 8 import 'common/resolution.dart' show Resolution; |
9 import 'common/tasks.dart' show CompilerTask; | 9 import 'common/tasks.dart' show CompilerTask; |
10 import 'common.dart'; | 10 import 'common.dart'; |
(...skipping 28 matching lines...) Expand all Loading... |
39 SetterElement, | 39 SetterElement, |
40 TypeDeclarationElement, | 40 TypeDeclarationElement, |
41 TypedElement, | 41 TypedElement, |
42 VariableElement; | 42 VariableElement; |
43 import 'resolution/class_members.dart' show MembersCreator; | 43 import 'resolution/class_members.dart' show MembersCreator; |
44 import 'resolution/tree_elements.dart' show TreeElements; | 44 import 'resolution/tree_elements.dart' show TreeElements; |
45 import 'tree/tree.dart'; | 45 import 'tree/tree.dart'; |
46 import 'util/util.dart' show Link, LinkBuilder; | 46 import 'util/util.dart' show Link, LinkBuilder; |
47 | 47 |
48 class TypeCheckerTask extends CompilerTask { | 48 class TypeCheckerTask extends CompilerTask { |
49 TypeCheckerTask(Compiler compiler) : super(compiler); | 49 final Compiler compiler; |
| 50 TypeCheckerTask(Compiler compiler) |
| 51 : compiler = compiler, |
| 52 super(compiler.measurer); |
| 53 |
50 String get name => "Type checker"; | 54 String get name => "Type checker"; |
| 55 DiagnosticReporter get reporter => compiler.reporter; |
51 | 56 |
52 void check(AstElement element) { | 57 void check(AstElement element) { |
53 if (element.isClass) return; | 58 if (element.isClass) return; |
54 if (element.isTypedef) return; | 59 if (element.isTypedef) return; |
55 ResolvedAst resolvedAst = element.resolvedAst; | 60 ResolvedAst resolvedAst = element.resolvedAst; |
56 reporter.withCurrentElement(element.implementation, () { | 61 reporter.withCurrentElement(element.implementation, () { |
57 measure(() { | 62 measure(() { |
58 TypeCheckerVisitor visitor = new TypeCheckerVisitor( | 63 TypeCheckerVisitor visitor = new TypeCheckerVisitor( |
59 compiler, resolvedAst.elements, compiler.types); | 64 compiler, resolvedAst.elements, compiler.types); |
60 if (element.isField) { | 65 if (element.isField) { |
(...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2018 | 2023 |
2019 visitTypedef(Typedef node) { | 2024 visitTypedef(Typedef node) { |
2020 // Do not typecheck [Typedef] nodes. | 2025 // Do not typecheck [Typedef] nodes. |
2021 } | 2026 } |
2022 | 2027 |
2023 visitNode(Node node) { | 2028 visitNode(Node node) { |
2024 reporter.internalError(node, | 2029 reporter.internalError(node, |
2025 'Unexpected node ${node.getObjectDescription()} in the type checker.'); | 2030 'Unexpected node ${node.getObjectDescription()} in the type checker.'); |
2026 } | 2031 } |
2027 } | 2032 } |
OLD | NEW |