OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library dart2js.resolution.signatures; | 5 library dart2js.resolution.signatures; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 307 |
308 // Create the types and elements corresponding to [typeVariableNodes]. | 308 // Create the types and elements corresponding to [typeVariableNodes]. |
309 Link<Node> nodes = typeVariableNodes.nodes; | 309 Link<Node> nodes = typeVariableNodes.nodes; |
310 List<DartType> arguments = | 310 List<DartType> arguments = |
311 new List.generate(nodes.slowLength(), (int index) { | 311 new List.generate(nodes.slowLength(), (int index) { |
312 TypeVariable node = nodes.head; | 312 TypeVariable node = nodes.head; |
313 String variableName = node.name.source; | 313 String variableName = node.name.source; |
314 nodes = nodes.tail; | 314 nodes = nodes.tail; |
315 TypeVariableElementX variableElement = | 315 TypeVariableElementX variableElement = |
316 new TypeVariableElementX(variableName, element, index, node); | 316 new TypeVariableElementX(variableName, element, index, node); |
317 // TODO(eernst): When type variables are implemented fully we will need | 317 // GENERIC_METHODS: When method type variables are implemented fully we |
318 // to resolve the actual bounds; currently we just claim [dynamic]. | 318 // must resolve the actual bounds; currently we just claim that |
| 319 // every method type variable has upper bound [dynamic]. |
319 variableElement.boundCache = const DynamicType(); | 320 variableElement.boundCache = const DynamicType(); |
320 TypeVariableType variableType = new TypeVariableType(variableElement); | 321 TypeVariableType variableType = |
| 322 new MethodTypeVariableType(variableElement); |
321 variableElement.typeCache = variableType; | 323 variableElement.typeCache = variableType; |
322 return variableType; | 324 return variableType; |
323 }, growable: false); | 325 }, growable: false); |
324 return arguments; | 326 return arguments; |
325 } | 327 } |
326 | 328 |
327 List<DartType> typeVariableTypes = createTypeVariables(typeVariables); | 329 List<DartType> typeVariableTypes = createTypeVariables(typeVariables); |
328 scope = new FunctionSignatureBuildingScope(scope, typeVariableTypes); | 330 scope = new FunctionSignatureBuildingScope(scope, typeVariableTypes); |
329 SignatureResolver visitor = new SignatureResolver( | 331 SignatureResolver visitor = new SignatureResolver( |
330 compiler, element, scope, registry, | 332 compiler, element, scope, registry, |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 /// variables of the function signature itself when its signature is analyzed. | 475 /// variables of the function signature itself when its signature is analyzed. |
474 class FunctionSignatureBuildingScope extends TypeVariablesScope { | 476 class FunctionSignatureBuildingScope extends TypeVariablesScope { |
475 @override | 477 @override |
476 final List<DartType> typeVariables; | 478 final List<DartType> typeVariables; |
477 | 479 |
478 FunctionSignatureBuildingScope(Scope parent, this.typeVariables) | 480 FunctionSignatureBuildingScope(Scope parent, this.typeVariables) |
479 : super(parent); | 481 : super(parent); |
480 | 482 |
481 String toString() => 'FunctionSignatureBuildingScope($typeVariables)'; | 483 String toString() => 'FunctionSignatureBuildingScope($typeVariables)'; |
482 } | 484 } |
OLD | NEW |