OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 fasta.procedure_builder; | 5 library fasta.procedure_builder; |
6 | 6 |
7 // Note: we're deliberately using AsyncMarker and ProcedureKind from kernel | 7 // Note: we're deliberately using AsyncMarker and ProcedureKind from kernel |
8 // outside the kernel-specific builders. This is simpler than creating | 8 // outside the kernel-specific builders. This is simpler than creating |
9 // additional enums. | 9 // additional enums. |
10 import 'package:kernel/ast.dart' show AsyncMarker, ProcedureKind; | 10 import 'package:kernel/ast.dart' show AsyncMarker, ProcedureKind; |
11 | 11 |
12 import 'builder.dart' | 12 import 'builder.dart' |
13 show | 13 show |
14 Builder, | 14 Builder, |
15 FormalParameterBuilder, | 15 FormalParameterBuilder, |
16 LibraryBuilder, | 16 LibraryBuilder, |
17 MemberBuilder, | 17 MemberBuilder, |
18 MetadataBuilder, | 18 MetadataBuilder, |
| 19 Scope, |
19 TypeBuilder, | 20 TypeBuilder, |
20 TypeVariableBuilder; | 21 TypeVariableBuilder; |
21 | 22 |
22 import 'scope.dart' show Scope; | |
23 | |
24 abstract class ProcedureBuilder<T extends TypeBuilder> extends MemberBuilder { | 23 abstract class ProcedureBuilder<T extends TypeBuilder> extends MemberBuilder { |
25 final List<MetadataBuilder> metadata; | 24 final List<MetadataBuilder> metadata; |
26 | 25 |
27 final int modifiers; | 26 final int modifiers; |
28 | 27 |
29 final T returnType; | 28 final T returnType; |
30 | 29 |
31 final String name; | 30 final String name; |
32 | 31 |
33 final List<TypeVariableBuilder> typeVariables; | 32 final List<TypeVariableBuilder> typeVariables; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 /// to support generic methods. | 80 /// to support generic methods. |
82 Scope computeTypeParameterScope(Scope parent) { | 81 Scope computeTypeParameterScope(Scope parent) { |
83 if (typeVariables == null) return parent; | 82 if (typeVariables == null) return parent; |
84 Map<String, Builder> local = <String, Builder>{}; | 83 Map<String, Builder> local = <String, Builder>{}; |
85 for (TypeVariableBuilder variable in typeVariables) { | 84 for (TypeVariableBuilder variable in typeVariables) { |
86 local[variable.name] = variable; | 85 local[variable.name] = variable; |
87 } | 86 } |
88 return new Scope(local, parent, isModifiable: false); | 87 return new Scope(local, parent, isModifiable: false); |
89 } | 88 } |
90 } | 89 } |
OLD | NEW |