| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.typedefs; | 5 library dart2js.resolution.typedefs; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/resolution.dart'; | 8 import '../common/resolution.dart'; |
| 9 import '../elements/resolution_types.dart'; | 9 import '../elements/resolution_types.dart'; |
| 10 import '../elements/elements.dart' | 10 import '../elements/elements.dart' |
| 11 show FunctionSignature, TypedefElement, TypeVariableElement; | 11 show FunctionSignature, TypedefElement, TypeVariableElement; |
| 12 import '../elements/modelx.dart' show ErroneousElementX, TypedefElementX; | 12 import '../elements/modelx.dart' show ErroneousElementX, TypedefElementX; |
| 13 import '../tree/tree.dart'; | 13 import '../tree/tree.dart'; |
| 14 import '../util/util.dart' show Link; | 14 import '../util/util.dart' show Link; |
| 15 import 'class_hierarchy.dart' show TypeDefinitionVisitor; | 15 import 'class_hierarchy.dart' show TypeDefinitionVisitor; |
| 16 import 'registry.dart' show ResolutionRegistry; | 16 import 'registry.dart' show ResolutionRegistry; |
| 17 import 'scope.dart' show MethodScope, TypeDeclarationScope; | 17 import 'scope.dart' show MethodScope, TypeDeclarationScope; |
| 18 import 'signatures.dart' show SignatureResolver; | 18 import 'signatures.dart' show SignatureResolver; |
| 19 | 19 |
| 20 class TypedefResolverVisitor extends TypeDefinitionVisitor { | 20 class TypedefResolverVisitor extends TypeDefinitionVisitor { |
| 21 TypedefElementX get element => enclosingElement; | 21 TypedefElementX get element => enclosingElement; |
| 22 | 22 |
| 23 TypedefResolverVisitor(Resolution resolution, TypedefElement typedefElement, | 23 TypedefResolverVisitor(Resolution resolution, TypedefElement typedefElement, |
| 24 ResolutionRegistry registry) | 24 ResolutionRegistry registry) |
| 25 : super(resolution, typedefElement, registry); | 25 : super(resolution, typedefElement, registry); |
| 26 | 26 |
| 27 visitTypedef(Typedef node) { | 27 visitTypedef(Typedef node) { |
| 28 element.computeType(resolution); | 28 element.computeType(resolution); |
| 29 scope = new TypeDeclarationScope(scope, element); | 29 scope = new TypeDeclarationScope(scope, element); |
| 30 resolveTypeVariableBounds(node.templateParameters); | 30 resolveTypeVariableBounds(node.typeParameters); |
| 31 | 31 |
| 32 FunctionSignature signature = SignatureResolver.analyze( | 32 FunctionSignature signature = SignatureResolver.analyze( |
| 33 resolution, | 33 resolution, |
| 34 scope, | 34 scope, |
| 35 node.typeParameters, | 35 null /* typeVariables */, |
| 36 node.formals, | 36 node.formals, |
| 37 node.returnType, | 37 node.returnType, |
| 38 element, | 38 element, |
| 39 registry, | 39 registry, |
| 40 defaultValuesError: MessageKind.TYPEDEF_FORMAL_WITH_DEFAULT); | 40 defaultValuesError: MessageKind.TYPEDEF_FORMAL_WITH_DEFAULT); |
| 41 element.functionSignature = signature; | 41 element.functionSignature = signature; |
| 42 | 42 |
| 43 scope = new MethodScope(scope, element); | 43 scope = new MethodScope(scope, element); |
| 44 signature.forEachParameter(addToScope); | 44 signature.forEachParameter(addToScope); |
| 45 | 45 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 if (seenTypeVariables.contains(typeVariableElement)) { | 136 if (seenTypeVariables.contains(typeVariableElement)) { |
| 137 // Avoid running in cycles on cyclic type variable bounds. | 137 // Avoid running in cycles on cyclic type variable bounds. |
| 138 // Cyclicity is reported elsewhere. | 138 // Cyclicity is reported elsewhere. |
| 139 return; | 139 return; |
| 140 } | 140 } |
| 141 seenTypeVariables = seenTypeVariables.prepend(typeVariableElement); | 141 seenTypeVariables = seenTypeVariables.prepend(typeVariableElement); |
| 142 typeVariableElement.bound.accept(this, null); | 142 typeVariableElement.bound.accept(this, null); |
| 143 seenTypeVariables = seenTypeVariables.tail; | 143 seenTypeVariables = seenTypeVariables.tail; |
| 144 } | 144 } |
| 145 } | 145 } |
| OLD | NEW |