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 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 bool get isRegularMethod => identical(ProcedureKind.Method, kind); | 47 bool get isRegularMethod => identical(ProcedureKind.Method, kind); |
48 | 48 |
49 bool get isGetter => identical(ProcedureKind.Getter, kind); | 49 bool get isGetter => identical(ProcedureKind.Getter, kind); |
50 | 50 |
51 bool get isSetter => identical(ProcedureKind.Setter, kind); | 51 bool get isSetter => identical(ProcedureKind.Setter, kind); |
52 | 52 |
53 bool get isOperator => identical(ProcedureKind.Operator, kind); | 53 bool get isOperator => identical(ProcedureKind.Operator, kind); |
54 | 54 |
55 bool get isFactory => identical(ProcedureKind.Factory, kind); | 55 bool get isFactory => identical(ProcedureKind.Factory, kind); |
56 | 56 |
57 void set body(statement); | 57 void set body(covariant statement); |
58 | 58 |
59 /// This is the formal parameter scope as specified in the Dart Programming | 59 /// This is the formal parameter scope as specified in the Dart Programming |
60 /// Language Specifiction, 4th ed, section 9.2. | 60 /// Language Specifiction, 4th ed, section 9.2. |
61 Scope computeFormalParameterScope(Scope parent) { | 61 Scope computeFormalParameterScope(Scope parent) { |
62 if (formals == null) return parent; | 62 if (formals == null) return parent; |
63 Map<String, Builder> local = <String, Builder>{}; | 63 Map<String, Builder> local = <String, Builder>{}; |
64 for (FormalParameterBuilder formal in formals) { | 64 for (FormalParameterBuilder formal in formals) { |
65 if (!formal.hasThis) { | 65 if (!formal.hasThis) { |
66 local[formal.name] = formal; | 66 local[formal.name] = formal; |
67 } | 67 } |
68 } | 68 } |
69 return new Scope(local, parent, isModifiable: false); | 69 return new Scope(local, parent, isModifiable: false); |
70 } | 70 } |
71 | 71 |
72 /// This scope doesn't correspond to any scope specified in the Dart | 72 /// This scope doesn't correspond to any scope specified in the Dart |
73 /// Programming Language Specifiction, 4th ed. It's an unspecified extension | 73 /// Programming Language Specifiction, 4th ed. It's an unspecified extension |
74 /// to support generic methods. | 74 /// to support generic methods. |
75 Scope computeTypeParameterScope(Scope parent) { | 75 Scope computeTypeParameterScope(Scope parent) { |
76 if (typeVariables == null) return parent; | 76 if (typeVariables == null) return parent; |
77 Map<String, Builder> local = <String, Builder>{}; | 77 Map<String, Builder> local = <String, Builder>{}; |
78 for (TypeVariableBuilder variable in typeVariables) { | 78 for (TypeVariableBuilder variable in typeVariables) { |
79 local[variable.name] = variable; | 79 local[variable.name] = variable; |
80 } | 80 } |
81 return new Scope(local, parent, isModifiable: false); | 81 return new Scope(local, parent, isModifiable: false); |
82 } | 82 } |
83 } | 83 } |
OLD | NEW |