| 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 | 10 import 'package:kernel/ast.dart' show |
| 11 AsyncMarker, | 11 AsyncMarker, |
| 12 ProcedureKind; | 12 ProcedureKind; |
| 13 | 13 |
| 14 import 'builder.dart' show | 14 import 'builder.dart' show |
| 15 Builder, | 15 Builder, |
| 16 FormalParameterBuilder, | 16 FormalParameterBuilder, |
| 17 LibraryBuilder, |
| 17 MemberBuilder, | 18 MemberBuilder, |
| 18 MetadataBuilder, | 19 MetadataBuilder, |
| 19 TypeBuilder, | 20 TypeBuilder, |
| 20 TypeVariableBuilder; | 21 TypeVariableBuilder; |
| 21 | 22 |
| 22 import 'scope.dart' show | 23 import 'scope.dart' show |
| 23 Scope; | 24 Scope; |
| 24 | 25 |
| 25 abstract class ProcedureBuilder<T extends TypeBuilder> extends MemberBuilder { | 26 abstract class ProcedureBuilder<T extends TypeBuilder> extends MemberBuilder { |
| 26 final List<MetadataBuilder> metadata; | 27 final List<MetadataBuilder> metadata; |
| 27 | 28 |
| 28 final int modifiers; | 29 final int modifiers; |
| 29 | 30 |
| 30 final T returnType; | 31 final T returnType; |
| 31 | 32 |
| 32 final String name; | 33 final String name; |
| 33 | 34 |
| 34 final List<TypeVariableBuilder> typeVariables; | 35 final List<TypeVariableBuilder> typeVariables; |
| 35 | 36 |
| 36 final List<FormalParameterBuilder> formals; | 37 final List<FormalParameterBuilder> formals; |
| 37 | 38 |
| 38 ProcedureBuilder(this.metadata, this.modifiers, this.returnType, this.name, | 39 ProcedureBuilder(this.metadata, this.modifiers, this.returnType, this.name, |
| 39 this.typeVariables, this.formals); | 40 this.typeVariables, this.formals, LibraryBuilder compilationUnit, |
| 41 int charOffset) |
| 42 : super(compilationUnit, charOffset); |
| 40 | 43 |
| 41 AsyncMarker get asyncModifier; | 44 AsyncMarker get asyncModifier; |
| 42 | 45 |
| 43 ProcedureKind get kind; | 46 ProcedureKind get kind; |
| 44 | 47 |
| 45 bool get isConstructor => false; | 48 bool get isConstructor => false; |
| 46 | 49 |
| 47 bool get isRegularMethod => identical(ProcedureKind.Method, kind); | 50 bool get isRegularMethod => identical(ProcedureKind.Method, kind); |
| 48 | 51 |
| 49 bool get isGetter => identical(ProcedureKind.Getter, kind); | 52 bool get isGetter => identical(ProcedureKind.Getter, kind); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 74 /// to support generic methods. | 77 /// to support generic methods. |
| 75 Scope computeTypeParameterScope(Scope parent) { | 78 Scope computeTypeParameterScope(Scope parent) { |
| 76 if (typeVariables == null) return parent; | 79 if (typeVariables == null) return parent; |
| 77 Map<String, Builder> local = <String, Builder>{}; | 80 Map<String, Builder> local = <String, Builder>{}; |
| 78 for (TypeVariableBuilder variable in typeVariables) { | 81 for (TypeVariableBuilder variable in typeVariables) { |
| 79 local[variable.name] = variable; | 82 local[variable.name] = variable; |
| 80 } | 83 } |
| 81 return new Scope(local, parent, isModifiable: false); | 84 return new Scope(local, parent, isModifiable: false); |
| 82 } | 85 } |
| 83 } | 86 } |
| OLD | NEW |