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.kernel_procedure_builder; | 5 library fasta.kernel_procedure_builder; |
6 | 6 |
7 import 'package:kernel/ast.dart' | 7 import 'package:kernel/ast.dart' |
8 show | 8 show |
9 Arguments, | 9 Arguments, |
10 AsyncMarker, | 10 AsyncMarker, |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 ..isConst = true; | 171 ..isConst = true; |
172 } | 172 } |
173 target.addAnnotation(annotation); | 173 target.addAnnotation(annotation); |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 class KernelProcedureBuilder extends KernelFunctionBuilder { | 177 class KernelProcedureBuilder extends KernelFunctionBuilder { |
178 final Procedure procedure; | 178 final Procedure procedure; |
179 final int charOpenParenOffset; | 179 final int charOpenParenOffset; |
180 | 180 |
181 AsyncMarker actualAsyncModifier; | 181 AsyncMarker actualAsyncModifier = AsyncMarker.Sync; |
182 | 182 |
183 final ConstructorReferenceBuilder redirectionTarget; | 183 final ConstructorReferenceBuilder redirectionTarget; |
184 | 184 |
185 KernelProcedureBuilder( | 185 KernelProcedureBuilder( |
186 List<MetadataBuilder> metadata, | 186 List<MetadataBuilder> metadata, |
187 int modifiers, | 187 int modifiers, |
188 KernelTypeBuilder returnType, | 188 KernelTypeBuilder returnType, |
189 String name, | 189 String name, |
190 List<TypeVariableBuilder> typeVariables, | 190 List<TypeVariableBuilder> typeVariables, |
191 List<FormalParameterBuilder> formals, | 191 List<FormalParameterBuilder> formals, |
192 this.actualAsyncModifier, | |
193 ProcedureKind kind, | 192 ProcedureKind kind, |
194 KernelLibraryBuilder compilationUnit, | 193 KernelLibraryBuilder compilationUnit, |
195 int charOffset, | 194 int charOffset, |
196 this.charOpenParenOffset, | 195 this.charOpenParenOffset, |
197 int charEndOffset, | 196 int charEndOffset, |
198 [String nativeMethodName, | 197 [String nativeMethodName, |
199 this.redirectionTarget]) | 198 this.redirectionTarget]) |
200 : procedure = new Procedure(null, kind, null, | 199 : procedure = new Procedure(null, kind, null, |
201 fileUri: compilationUnit?.relativeFileUri) | 200 fileUri: compilationUnit?.relativeFileUri) |
202 ..fileOffset = charOffset | 201 ..fileOffset = charOffset |
(...skipping 13 matching lines...) Expand all Loading... | |
216 actualBody = new EmptyStatement(); | 215 actualBody = new EmptyStatement(); |
217 } | 216 } |
218 return actualBody; | 217 return actualBody; |
219 } | 218 } |
220 | 219 |
221 void set asyncModifier(AsyncMarker newModifier) { | 220 void set asyncModifier(AsyncMarker newModifier) { |
222 actualAsyncModifier = newModifier; | 221 actualAsyncModifier = newModifier; |
223 if (function != null) { | 222 if (function != null) { |
224 // No parent, it's an enum. | 223 // No parent, it's an enum. |
225 function.asyncMarker = actualAsyncModifier; | 224 function.asyncMarker = actualAsyncModifier; |
225 function.dartAsyncMarker = actualAsyncModifier; | |
Siggi Cherem (dart-lang)
2017/05/18 19:44:03
Note: when `function` is created we will pass Asyn
| |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 Procedure build(LibraryBuilder library) { | 229 Procedure build(LibraryBuilder library) { |
230 // TODO(ahe): I think we may call this twice on parts. Investigate. | 230 // TODO(ahe): I think we may call this twice on parts. Investigate. |
231 if (procedure.name == null) { | 231 if (procedure.name == null) { |
232 procedure.function = buildFunction(library); | 232 procedure.function = buildFunction(library); |
233 procedure.function.parent = procedure; | 233 procedure.function.parent = procedure; |
234 procedure.function.fileOffset = charOpenParenOffset; | 234 procedure.function.fileOffset = charOpenParenOffset; |
235 procedure.function.fileEndOffset = procedure.fileEndOffset; | 235 procedure.function.fileEndOffset = procedure.fileEndOffset; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 } | 362 } |
363 } | 363 } |
364 initializers.add(initializer..parent = constructor); | 364 initializers.add(initializer..parent = constructor); |
365 initializers.add(superInitializer); | 365 initializers.add(superInitializer); |
366 return; | 366 return; |
367 } | 367 } |
368 initializers.add(initializer); | 368 initializers.add(initializer); |
369 initializer.parent = constructor; | 369 initializer.parent = constructor; |
370 } | 370 } |
371 } | 371 } |
OLD | NEW |