| 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 class TypeCheckerTask extends CompilerTask { | 5 class TypeCheckerTask extends CompilerTask { |
| 6 TypeCheckerTask(Compiler compiler) : super(compiler); | 6 TypeCheckerTask(Compiler compiler) : super(compiler); |
| 7 String get name => "Type checker"; | 7 String get name => "Type checker"; |
| 8 | 8 |
| 9 static final bool LOG_FAILURES = false; | 9 static const bool LOG_FAILURES = false; |
| 10 | 10 |
| 11 void check(Node tree, TreeElements elements) { | 11 void check(Node tree, TreeElements elements) { |
| 12 measure(() { | 12 measure(() { |
| 13 Visitor visitor = | 13 Visitor visitor = |
| 14 new TypeCheckerVisitor(compiler, elements, compiler.types); | 14 new TypeCheckerVisitor(compiler, elements, compiler.types); |
| 15 try { | 15 try { |
| 16 tree.accept(visitor); | 16 tree.accept(visitor); |
| 17 } catch (CancelTypeCheckException e) { | 17 } catch (CancelTypeCheckException e) { |
| 18 if (LOG_FAILURES) { | 18 if (LOG_FAILURES) { |
| 19 // Do not warn about unimplemented features; log message instead. | 19 // Do not warn about unimplemented features; log message instead. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 * A statement type tracks whether a statement returns or may return. | 57 * A statement type tracks whether a statement returns or may return. |
| 58 */ | 58 */ |
| 59 class StatementType implements Type { | 59 class StatementType implements Type { |
| 60 final String stringName; | 60 final String stringName; |
| 61 Element get element => null; | 61 Element get element => null; |
| 62 | 62 |
| 63 SourceString get name => new SourceString(stringName); | 63 SourceString get name => new SourceString(stringName); |
| 64 | 64 |
| 65 const StatementType(this.stringName); | 65 const StatementType(this.stringName); |
| 66 | 66 |
| 67 static final RETURNING = const StatementType('<returning>'); | 67 static const RETURNING = const StatementType('<returning>'); |
| 68 static final NOT_RETURNING = const StatementType('<not returning>'); | 68 static const NOT_RETURNING = const StatementType('<not returning>'); |
| 69 static final MAYBE_RETURNING = const StatementType('<maybe returning>'); | 69 static const MAYBE_RETURNING = const StatementType('<maybe returning>'); |
| 70 | 70 |
| 71 /** Combine the information about two control-flow edges that are joined. */ | 71 /** Combine the information about two control-flow edges that are joined. */ |
| 72 StatementType join(StatementType other) { | 72 StatementType join(StatementType other) { |
| 73 return (this === other) ? this : MAYBE_RETURNING; | 73 return (this === other) ? this : MAYBE_RETURNING; |
| 74 } | 74 } |
| 75 | 75 |
| 76 Type unalias(Compiler compiler) => this; | 76 Type unalias(Compiler compiler) => this; |
| 77 | 77 |
| 78 String toString() => stringName; | 78 String toString() => stringName; |
| 79 } | 79 } |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 } | 843 } |
| 844 | 844 |
| 845 visitCatchBlock(CatchBlock node) { | 845 visitCatchBlock(CatchBlock node) { |
| 846 return unhandledStatement(); | 846 return unhandledStatement(); |
| 847 } | 847 } |
| 848 | 848 |
| 849 visitTypedef(Typedef node) { | 849 visitTypedef(Typedef node) { |
| 850 return unhandledStatement(); | 850 return unhandledStatement(); |
| 851 } | 851 } |
| 852 } | 852 } |
| OLD | NEW |