| 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 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 Element dynamicElement, | 246 Element dynamicElement, |
| 247 LibraryElement library) | 247 LibraryElement library) |
| 248 : voidType = new VoidType(new VoidElement(library)), | 248 : voidType = new VoidType(new VoidElement(library)), |
| 249 dynamicType = new InterfaceType(dynamicElement); | 249 dynamicType = new InterfaceType(dynamicElement); |
| 250 | 250 |
| 251 /** Returns true if t is a subtype of s */ | 251 /** Returns true if t is a subtype of s */ |
| 252 bool isSubtype(DartType t, DartType s) { | 252 bool isSubtype(DartType t, DartType s) { |
| 253 if (t === s || | 253 if (t === s || |
| 254 t === dynamicType || | 254 t === dynamicType || |
| 255 s === dynamicType || | 255 s === dynamicType || |
| 256 s.element === compiler.objectClass) { | 256 s.element === compiler.objectClass || |
| 257 t.element === compiler.nullClass) { |
| 257 return true; | 258 return true; |
| 258 } | 259 } |
| 259 t = t.unalias(compiler); | 260 t = t.unalias(compiler); |
| 260 s = s.unalias(compiler); | 261 s = s.unalias(compiler); |
| 261 | 262 |
| 262 if (t is VoidType) { | 263 if (t is VoidType) { |
| 263 return false; | 264 return false; |
| 264 } else if (t is InterfaceType) { | 265 } else if (t is InterfaceType) { |
| 265 if (s is !InterfaceType) return false; | 266 if (s is !InterfaceType) return false; |
| 266 ClassElement tc = t.element; | 267 ClassElement tc = t.element; |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 } | 904 } |
| 904 | 905 |
| 905 visitCatchBlock(CatchBlock node) { | 906 visitCatchBlock(CatchBlock node) { |
| 906 return unhandledStatement(); | 907 return unhandledStatement(); |
| 907 } | 908 } |
| 908 | 909 |
| 909 visitTypedef(Typedef node) { | 910 visitTypedef(Typedef node) { |
| 910 return unhandledStatement(); | 911 return unhandledStatement(); |
| 911 } | 912 } |
| 912 } | 913 } |
| OLD | NEW |