| 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 final bool LOG_FAILURES = false; |
| 10 | 10 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 class Types { | 127 class Types { |
| 128 final VoidType voidType; | 128 final VoidType voidType; |
| 129 final InterfaceType dynamicType; | 129 final InterfaceType dynamicType; |
| 130 | 130 |
| 131 Types(Element dynamicElement) | 131 Types(Element dynamicElement) |
| 132 : this.with(dynamicElement, new LibraryElement(new Script(null, null))); | 132 : this.with(dynamicElement, new LibraryElement(new Script(null, null))); |
| 133 | 133 |
| 134 // TODO(karlklose): should we have a class Void? | 134 // TODO(karlklose): should we have a class Void? |
| 135 Types.with(Element dynamicElement, LibraryElement library) | 135 Types.with(Element dynamicElement, LibraryElement library) |
| 136 : voidType = new VoidType(new VoidElement(library)), | 136 : voidType = new VoidType(new VoidElement(library.entryCompilationUnit)), |
| 137 dynamicType = new InterfaceType(dynamicElement); | 137 dynamicType = new InterfaceType(dynamicElement); |
| 138 | 138 |
| 139 /** Returns true if t is a subtype of s */ | 139 /** Returns true if t is a subtype of s */ |
| 140 bool isSubtype(Type t, Type s) { | 140 bool isSubtype(Type t, Type s) { |
| 141 if (t === s || t === dynamicType || s === dynamicType || | 141 if (t === s || t === dynamicType || s === dynamicType || |
| 142 // TODO(karlklose): Test for s.element === compiler.objectClass. | 142 // TODO(karlklose): Test for s.element === compiler.objectClass. |
| 143 s.name == const SourceString('Object')) return true; | 143 s.name == const SourceString('Object')) return true; |
| 144 if (t is VoidType) { | 144 if (t is VoidType) { |
| 145 return false; | 145 return false; |
| 146 } else if (t is InterfaceType) { | 146 } else if (t is InterfaceType) { |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 } | 781 } |
| 782 | 782 |
| 783 visitCatchBlock(CatchBlock node) { | 783 visitCatchBlock(CatchBlock node) { |
| 784 return unhandledStatement(); | 784 return unhandledStatement(); |
| 785 } | 785 } |
| 786 | 786 |
| 787 visitTypedef(Typedef node) { | 787 visitTypedef(Typedef node) { |
| 788 return unhandledStatement(); | 788 return unhandledStatement(); |
| 789 } | 789 } |
| 790 } | 790 } |
| OLD | NEW |