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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 typeArguments.printOn(sb, ', '); | 225 typeArguments.printOn(sb, ', '); |
226 sb.add('>'); | 226 sb.add('>'); |
227 } | 227 } |
228 return sb.toString(); | 228 return sb.toString(); |
229 } | 229 } |
230 } | 230 } |
231 | 231 |
232 class FunctionType implements Type { | 232 class FunctionType implements Type { |
233 final Element element; | 233 final Element element; |
234 final Type returnType; | 234 final Type returnType; |
235 final Link<Type> parameterTypes; | 235 Link<Type> parameterTypes; |
236 | 236 |
237 const FunctionType(Type this.returnType, Link<Type> this.parameterTypes, | 237 FunctionType(Type this.returnType, Link<Type> this.parameterTypes, |
238 Element this.element); | 238 Element this.element); |
239 | 239 |
240 Type subst(Compiler compiler, Link<Type> arguments, | 240 Type subst(Compiler compiler, Link<Type> arguments, |
241 LinkedHashMap<SourceString, TypeVariableElement> typeParameters) { | 241 LinkedHashMap<SourceString, TypeVariableElement> typeParameters) { |
242 if (typeParameters.isEmpty()) { | 242 if (typeParameters.isEmpty()) { |
243 // Return fast on empty substitutions. | 243 // Return fast on empty substitutions. |
244 return this; | 244 return this; |
245 } | 245 } |
246 var newReturnType = returnType.subst(compiler, arguments, typeParameters); | 246 var newReturnType = returnType.subst(compiler, arguments, typeParameters); |
247 bool changed = newReturnType !== returnType; | 247 bool changed = newReturnType !== returnType; |
248 var newParameterTypesBuilder = new LinkBuilder<Type>(); | 248 var newParameterTypesBuilder = new LinkBuilder<Type>(); |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 } | 1073 } |
1074 | 1074 |
1075 visitCatchBlock(CatchBlock node) { | 1075 visitCatchBlock(CatchBlock node) { |
1076 return unhandledStatement(); | 1076 return unhandledStatement(); |
1077 } | 1077 } |
1078 | 1078 |
1079 visitTypedef(Typedef node) { | 1079 visitTypedef(Typedef node) { |
1080 return unhandledStatement(); | 1080 return unhandledStatement(); |
1081 } | 1081 } |
1082 } | 1082 } |
OLD | NEW |