| 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.dart'; | 7 import 'common.dart'; |
| 8 import 'common/names.dart' show Identifiers; | 8 import 'common/names.dart' show Identifiers; |
| 9 import 'common/resolution.dart' show Resolution; | 9 import 'common/resolution.dart' show Resolution; |
| 10 import 'common/tasks.dart' show CompilerTask; | 10 import 'common/tasks.dart' show CompilerTask; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 VariableElement; | 44 VariableElement; |
| 45 import 'resolution/tree_elements.dart' show TreeElements; | 45 import 'resolution/tree_elements.dart' show TreeElements; |
| 46 import 'resolution/class_members.dart' show MembersCreator; | 46 import 'resolution/class_members.dart' show MembersCreator; |
| 47 import 'tree/tree.dart'; | 47 import 'tree/tree.dart'; |
| 48 import 'util/util.dart' show Link, LinkBuilder; | 48 import 'util/util.dart' show Link, LinkBuilder; |
| 49 | 49 |
| 50 class TypeCheckerTask extends CompilerTask { | 50 class TypeCheckerTask extends CompilerTask { |
| 51 TypeCheckerTask(Compiler compiler) : super(compiler); | 51 TypeCheckerTask(Compiler compiler) : super(compiler); |
| 52 String get name => "Type checker"; | 52 String get name => "Type checker"; |
| 53 | 53 |
| 54 bool enabled = false; |
| 55 |
| 54 void check(AstElement element) { | 56 void check(AstElement element) { |
| 55 return; | 57 if (!enabled) return; |
| 56 if (element.isClass) return; | 58 if (element.isClass) return; |
| 57 if (element.isTypedef) return; | 59 if (element.isTypedef) return; |
| 58 ResolvedAst resolvedAst = element.resolvedAst; | 60 ResolvedAst resolvedAst = element.resolvedAst; |
| 59 if (resolvedAst.node == null) { | |
| 60 return; | |
| 61 new FiskFisk(); | |
| 62 } | |
| 63 reporter.withCurrentElement(element.implementation, () { | 61 reporter.withCurrentElement(element.implementation, () { |
| 64 measure(() { | 62 measure(() { |
| 65 TypeCheckerVisitor visitor = new TypeCheckerVisitor( | 63 TypeCheckerVisitor visitor = new TypeCheckerVisitor( |
| 66 compiler, resolvedAst.elements, compiler.types); | 64 compiler, resolvedAst.elements, compiler.types); |
| 67 if (element.isField) { | 65 if (element.isField) { |
| 68 visitor.analyzingInitializer = true; | 66 visitor.analyzingInitializer = true; |
| 69 } | 67 } |
| 70 resolvedAst.node.accept(visitor); | 68 resolvedAst.node.accept(visitor); |
| 71 }); | 69 }); |
| 72 }); | 70 }); |
| (...skipping 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2023 | 2021 |
| 2024 visitTypedef(Typedef node) { | 2022 visitTypedef(Typedef node) { |
| 2025 // Do not typecheck [Typedef] nodes. | 2023 // Do not typecheck [Typedef] nodes. |
| 2026 } | 2024 } |
| 2027 | 2025 |
| 2028 visitNode(Node node) { | 2026 visitNode(Node node) { |
| 2029 reporter.internalError(node, | 2027 reporter.internalError(node, |
| 2030 'Unexpected node ${node.getObjectDescription()} in the type checker.'); | 2028 'Unexpected node ${node.getObjectDescription()} in the type checker.'); |
| 2031 } | 2029 } |
| 2032 } | 2030 } |
| OLD | NEW |