| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 String name, | 73 String name, |
| 74 List<TypeVariableBuilder> typeVariables, | 74 List<TypeVariableBuilder> typeVariables, |
| 75 List<FormalParameterBuilder> formals, | 75 List<FormalParameterBuilder> formals, |
| 76 KernelLibraryBuilder compilationUnit, | 76 KernelLibraryBuilder compilationUnit, |
| 77 int charOffset, | 77 int charOffset, |
| 78 this.nativeMethodName) | 78 this.nativeMethodName) |
| 79 : super(metadata, modifiers, returnType, name, typeVariables, formals, | 79 : super(metadata, modifiers, returnType, name, typeVariables, formals, |
| 80 compilationUnit, charOffset); | 80 compilationUnit, charOffset); |
| 81 | 81 |
| 82 void set body(Statement newBody) { | 82 void set body(Statement newBody) { |
| 83 if (isAbstract && newBody != null) { | 83 if (newBody != null) { |
| 84 return internalError("Attempting to set body on abstract method."); | 84 if (isAbstract) { |
| 85 return internalError("Attempting to set body on abstract method."); |
| 86 } |
| 87 if (isExternal) { |
| 88 return library.addCompileTimeError( |
| 89 newBody.fileOffset, "An external method can't have a body."); |
| 90 } |
| 85 } | 91 } |
| 86 actualBody = newBody; | 92 actualBody = newBody; |
| 87 if (function != null) { | 93 if (function != null) { |
| 88 function.body = newBody; | 94 function.body = newBody; |
| 89 newBody?.parent = function; | 95 newBody?.parent = function; |
| 90 } | 96 } |
| 91 } | 97 } |
| 92 | 98 |
| 93 Statement get body => actualBody ??= new EmptyStatement(); | 99 Statement get body => actualBody ??= new EmptyStatement(); |
| 94 | 100 |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 } | 368 } |
| 363 } | 369 } |
| 364 initializers.add(initializer..parent = constructor); | 370 initializers.add(initializer..parent = constructor); |
| 365 initializers.add(superInitializer); | 371 initializers.add(superInitializer); |
| 366 return; | 372 return; |
| 367 } | 373 } |
| 368 initializers.add(initializer); | 374 initializers.add(initializer); |
| 369 initializer.parent = constructor; | 375 initializer.parent = constructor; |
| 370 } | 376 } |
| 371 } | 377 } |
| OLD | NEW |