| 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 const 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 } on CancelTypeCheckException catch (e) { | 17 } on CancelTypeCheckException catch (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. |
| 20 compiler.log("'${e.node}': ${e.reason}"); | 20 compiler.log("'${e.node}': ${e.reason}"); |
| 21 } | 21 } |
| 22 } | 22 } |
| 23 }); | 23 }); |
| 24 } | 24 } |
| 25 } | 25 } |
| 26 | 26 |
| 27 abstract class DartType implements Hashable { | 27 abstract class DartType implements Hashable { |
| 28 abstract SourceString get name(); | 28 abstract SourceString get name; |
| 29 abstract Element get element(); | 29 abstract Element get element; |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * Returns the unaliased type of this type. | 32 * Returns the unaliased type of this type. |
| 33 * | 33 * |
| 34 * The unaliased type of a typedef'd type is the unaliased type to which its | 34 * The unaliased type of a typedef'd type is the unaliased type to which its |
| 35 * name is bound. The unaliased version of any other type is the type itself. | 35 * name is bound. The unaliased version of any other type is the type itself. |
| 36 * | 36 * |
| 37 * For example, the unaliased type of [: typedef A Func<A,B>(B b) :] is the | 37 * For example, the unaliased type of [: typedef A Func<A,B>(B b) :] is the |
| 38 * function type [: (B) -> A :] and the unaliased type of | 38 * function type [: (B) -> A :] and the unaliased type of |
| 39 * [: Func<int,String> :] is the function type [: (String) -> int :]. | 39 * [: Func<int,String> :] is the function type [: (String) -> int :]. |
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 } | 903 } |
| 904 | 904 |
| 905 visitCatchBlock(CatchBlock node) { | 905 visitCatchBlock(CatchBlock node) { |
| 906 return unhandledStatement(); | 906 return unhandledStatement(); |
| 907 } | 907 } |
| 908 | 908 |
| 909 visitTypedef(Typedef node) { | 909 visitTypedef(Typedef node) { |
| 910 return unhandledStatement(); | 910 return unhandledStatement(); |
| 911 } | 911 } |
| 912 } | 912 } |
| OLD | NEW |