| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 List<MetadataBuilder> metadata, | 184 List<MetadataBuilder> metadata, |
| 185 int modifiers, | 185 int modifiers, |
| 186 KernelTypeBuilder returnType, | 186 KernelTypeBuilder returnType, |
| 187 String name, | 187 String name, |
| 188 List<TypeVariableBuilder> typeVariables, | 188 List<TypeVariableBuilder> typeVariables, |
| 189 List<FormalParameterBuilder> formals, | 189 List<FormalParameterBuilder> formals, |
| 190 this.actualAsyncModifier, | 190 this.actualAsyncModifier, |
| 191 ProcedureKind kind, | 191 ProcedureKind kind, |
| 192 KernelLibraryBuilder compilationUnit, | 192 KernelLibraryBuilder compilationUnit, |
| 193 int charOffset, | 193 int charOffset, |
| 194 int charEndOffset, |
| 194 [String nativeMethodName, | 195 [String nativeMethodName, |
| 195 this.redirectionTarget]) | 196 this.redirectionTarget]) |
| 196 : procedure = new Procedure(null, kind, null, | 197 : procedure = new Procedure(null, kind, null, |
| 197 fileUri: compilationUnit?.relativeFileUri), | 198 fileUri: compilationUnit?.relativeFileUri) |
| 199 ..fileOffset = charOffset |
| 200 ..fileEndOffset = charEndOffset, |
| 198 super(metadata, modifiers, returnType, name, typeVariables, formals, | 201 super(metadata, modifiers, returnType, name, typeVariables, formals, |
| 199 compilationUnit, charOffset, nativeMethodName); | 202 compilationUnit, charOffset, nativeMethodName); |
| 200 | 203 |
| 201 ProcedureKind get kind => procedure.kind; | 204 ProcedureKind get kind => procedure.kind; |
| 202 | 205 |
| 203 AsyncMarker get asyncModifier => actualAsyncModifier; | 206 AsyncMarker get asyncModifier => actualAsyncModifier; |
| 204 | 207 |
| 205 Statement get body { | 208 Statement get body { |
| 206 if (actualBody == null && | 209 if (actualBody == null && |
| 207 redirectionTarget == null && | 210 redirectionTarget == null && |
| (...skipping 24 matching lines...) Expand all Loading... |
| 232 procedure.name = new Name(name, library); | 235 procedure.name = new Name(name, library); |
| 233 } | 236 } |
| 234 return procedure; | 237 return procedure; |
| 235 } | 238 } |
| 236 | 239 |
| 237 Procedure get target => procedure; | 240 Procedure get target => procedure; |
| 238 } | 241 } |
| 239 | 242 |
| 240 // TODO(ahe): Move this to own file? | 243 // TODO(ahe): Move this to own file? |
| 241 class KernelConstructorBuilder extends KernelFunctionBuilder { | 244 class KernelConstructorBuilder extends KernelFunctionBuilder { |
| 242 final Constructor constructor = new Constructor(null); | 245 final Constructor constructor; |
| 243 | 246 |
| 244 bool hasMovedSuperInitializer = false; | 247 bool hasMovedSuperInitializer = false; |
| 245 | 248 |
| 246 SuperInitializer superInitializer; | 249 SuperInitializer superInitializer; |
| 247 | 250 |
| 248 RedirectingInitializer redirectingInitializer; | 251 RedirectingInitializer redirectingInitializer; |
| 249 | 252 |
| 250 KernelConstructorBuilder( | 253 KernelConstructorBuilder( |
| 251 List<MetadataBuilder> metadata, | 254 List<MetadataBuilder> metadata, |
| 252 int modifiers, | 255 int modifiers, |
| 253 KernelTypeBuilder returnType, | 256 KernelTypeBuilder returnType, |
| 254 String name, | 257 String name, |
| 255 List<TypeVariableBuilder> typeVariables, | 258 List<TypeVariableBuilder> typeVariables, |
| 256 List<FormalParameterBuilder> formals, | 259 List<FormalParameterBuilder> formals, |
| 257 KernelLibraryBuilder compilationUnit, | 260 KernelLibraryBuilder compilationUnit, |
| 258 int charOffset, | 261 int charOffset, |
| 262 int charEndOffset, |
| 259 [String nativeMethodName]) | 263 [String nativeMethodName]) |
| 260 : super(metadata, modifiers, returnType, name, typeVariables, formals, | 264 : constructor = new Constructor(null) |
| 265 ..fileOffset = charOffset |
| 266 ..fileEndOffset = charEndOffset, |
| 267 super(metadata, modifiers, returnType, name, typeVariables, formals, |
| 261 compilationUnit, charOffset, nativeMethodName); | 268 compilationUnit, charOffset, nativeMethodName); |
| 262 | 269 |
| 263 bool get isInstanceMember => false; | 270 bool get isInstanceMember => false; |
| 264 | 271 |
| 265 bool get isConstructor => true; | 272 bool get isConstructor => true; |
| 266 | 273 |
| 267 AsyncMarker get asyncModifier => AsyncMarker.Sync; | 274 AsyncMarker get asyncModifier => AsyncMarker.Sync; |
| 268 | 275 |
| 269 ProcedureKind get kind => null; | 276 ProcedureKind get kind => null; |
| 270 | 277 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 } | 348 } |
| 342 } | 349 } |
| 343 initializers.add(initializer..parent = constructor); | 350 initializers.add(initializer..parent = constructor); |
| 344 initializers.add(superInitializer); | 351 initializers.add(superInitializer); |
| 345 return; | 352 return; |
| 346 } | 353 } |
| 347 initializers.add(initializer); | 354 initializers.add(initializer); |
| 348 initializer.parent = constructor; | 355 initializer.parent = constructor; |
| 349 } | 356 } |
| 350 } | 357 } |
| OLD | NEW |