| 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 part of dart2js; | 5 part of dart2js; |
| 6 | 6 |
| 7 class TypeCheckerTask extends CompilerTask { | 7 class TypeCheckerTask extends CompilerTask { |
| 8 TypeCheckerTask(Compiler compiler) : super(compiler); | 8 TypeCheckerTask(Compiler compiler) : super(compiler); |
| 9 String get name => "Type checker"; | 9 String get name => "Type checker"; |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 * The unaliased type of a typedef'd type is the unaliased type to which its | 63 * The unaliased type of a typedef'd type is the unaliased type to which its |
| 64 * name is bound. The unaliased version of any other type is the type itself. | 64 * name is bound. The unaliased version of any other type is the type itself. |
| 65 * | 65 * |
| 66 * For example, the unaliased type of [: typedef A Func<A,B>(B b) :] is the | 66 * For example, the unaliased type of [: typedef A Func<A,B>(B b) :] is the |
| 67 * function type [: (B) -> A :] and the unaliased type of | 67 * function type [: (B) -> A :] and the unaliased type of |
| 68 * [: Func<int,String> :] is the function type [: (String) -> int :]. | 68 * [: Func<int,String> :] is the function type [: (String) -> int :]. |
| 69 */ | 69 */ |
| 70 abstract DartType unalias(Compiler compiler); | 70 abstract DartType unalias(Compiler compiler); |
| 71 | 71 |
| 72 abstract bool operator ==(other); | 72 abstract bool operator ==(other); |
| 73 |
| 74 DartType asRaw() => this; |
| 73 } | 75 } |
| 74 | 76 |
| 75 class TypeVariableType implements DartType { | 77 class TypeVariableType implements DartType { |
| 76 final TypeVariableElement element; | 78 final TypeVariableElement element; |
| 77 | 79 |
| 78 TypeVariableType(this.element); | 80 TypeVariableType(this.element); |
| 79 | 81 |
| 80 TypeKind get kind => TypeKind.TYPE_VARIABLE; | 82 TypeKind get kind => TypeKind.TYPE_VARIABLE; |
| 81 | 83 |
| 82 SourceString get name => element.name; | 84 SourceString get name => element.name; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 hash = 17 * hash + 3 * argumentHash; | 181 hash = 17 * hash + 3 * argumentHash; |
| 180 } | 182 } |
| 181 return hash; | 183 return hash; |
| 182 } | 184 } |
| 183 | 185 |
| 184 bool operator ==(other) { | 186 bool operator ==(other) { |
| 185 if (other is !InterfaceType) return false; | 187 if (other is !InterfaceType) return false; |
| 186 if (!identical(element, other.element)) return false; | 188 if (!identical(element, other.element)) return false; |
| 187 return arguments == other.arguments; | 189 return arguments == other.arguments; |
| 188 } | 190 } |
| 191 |
| 192 InterfaceType asRaw() { |
| 193 if (arguments.isEmpty) return this; |
| 194 return new InterfaceType(element); |
| 195 } |
| 189 } | 196 } |
| 190 | 197 |
| 191 class FunctionType implements DartType { | 198 class FunctionType implements DartType { |
| 192 final Element element; | 199 final Element element; |
| 193 DartType returnType; | 200 DartType returnType; |
| 194 Link<DartType> parameterTypes; | 201 Link<DartType> parameterTypes; |
| 195 | 202 |
| 196 FunctionType(DartType this.returnType, Link<DartType> this.parameterTypes, | 203 FunctionType(DartType this.returnType, Link<DartType> this.parameterTypes, |
| 197 Element this.element) { | 204 Element this.element) { |
| 198 assert(element == null || invariant(element, element.isDeclaration)); | 205 assert(element == null || invariant(element, element.isDeclaration)); |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 } | 1028 } |
| 1022 | 1029 |
| 1023 DartType visitStringNode(StringNode node) { | 1030 DartType visitStringNode(StringNode node) { |
| 1024 compiler.unimplemented('visitNode', node: node); | 1031 compiler.unimplemented('visitNode', node: node); |
| 1025 } | 1032 } |
| 1026 | 1033 |
| 1027 DartType visitLibraryDependency(LibraryDependency node) { | 1034 DartType visitLibraryDependency(LibraryDependency node) { |
| 1028 compiler.unimplemented('visitNode', node: node); | 1035 compiler.unimplemented('visitNode', node: node); |
| 1029 } | 1036 } |
| 1030 } | 1037 } |
| OLD | NEW |