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 21 matching lines...) Expand all Loading... |
32 VariableGet, | 32 VariableGet, |
33 VoidType, | 33 VoidType, |
34 setParents; | 34 setParents; |
35 | 35 |
36 import 'package:kernel/type_algebra.dart' show containsTypeVariable, substitute; | 36 import 'package:kernel/type_algebra.dart' show containsTypeVariable, substitute; |
37 | 37 |
38 import '../loader.dart' show Loader; | 38 import '../loader.dart' show Loader; |
39 | 39 |
40 import '../messages.dart' | 40 import '../messages.dart' |
41 show | 41 show |
| 42 messageConstConstructorWithBody, |
| 43 messageExternalMethodWithBody, |
42 messageInternalProblemBodyOnAbstractMethod, | 44 messageInternalProblemBodyOnAbstractMethod, |
43 messageNonInstanceTypeVariableUse, | 45 messageNonInstanceTypeVariableUse, |
44 warning; | 46 warning; |
45 | 47 |
46 import '../problems.dart' show internalProblem; | 48 import '../problems.dart' show internalProblem; |
47 | 49 |
48 import '../source/source_library_builder.dart' show SourceLibraryBuilder; | 50 import '../source/source_library_builder.dart' show SourceLibraryBuilder; |
49 | 51 |
50 import '../type_inference/type_inference_listener.dart' | 52 import '../type_inference/type_inference_listener.dart' |
51 show TypeInferenceListener; | 53 show TypeInferenceListener; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 : super(metadata, modifiers, returnType, name, typeVariables, formals, | 92 : super(metadata, modifiers, returnType, name, typeVariables, formals, |
91 compilationUnit, charOffset); | 93 compilationUnit, charOffset); |
92 | 94 |
93 void set body(Statement newBody) { | 95 void set body(Statement newBody) { |
94 if (newBody != null) { | 96 if (newBody != null) { |
95 if (isAbstract) { | 97 if (isAbstract) { |
96 return internalProblem(messageInternalProblemBodyOnAbstractMethod, | 98 return internalProblem(messageInternalProblemBodyOnAbstractMethod, |
97 newBody.fileOffset, fileUri); | 99 newBody.fileOffset, fileUri); |
98 } | 100 } |
99 if (isExternal) { | 101 if (isExternal) { |
100 return library.deprecated_addCompileTimeError( | 102 return library.addCompileTimeError( |
101 newBody.fileOffset, "An external method can't have a body."); | 103 messageExternalMethodWithBody, newBody.fileOffset, fileUri); |
102 } | 104 } |
103 if (isConstructor && isConst) { | 105 if (isConstructor && isConst) { |
104 return library.deprecated_addCompileTimeError( | 106 return library.addCompileTimeError( |
105 newBody.fileOffset, "A const constructor can't have a body."); | 107 messageConstConstructorWithBody, newBody.fileOffset, fileUri); |
106 } | 108 } |
107 } | 109 } |
108 actualBody = newBody; | 110 actualBody = newBody; |
109 if (function != null) { | 111 if (function != null) { |
110 function.body = newBody; | 112 function.body = newBody; |
111 newBody?.parent = function; | 113 newBody?.parent = function; |
112 } | 114 } |
113 } | 115 } |
114 | 116 |
115 Statement get body => actualBody ??= new EmptyStatement(); | 117 Statement get body => actualBody ??= new EmptyStatement(); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } | 414 } |
413 } | 415 } |
414 initializers.add(initializer..parent = constructor); | 416 initializers.add(initializer..parent = constructor); |
415 initializers.add(superInitializer); | 417 initializers.add(superInitializer); |
416 return; | 418 return; |
417 } | 419 } |
418 initializers.add(initializer); | 420 initializers.add(initializer); |
419 initializer.parent = constructor; | 421 initializer.parent = constructor; |
420 } | 422 } |
421 } | 423 } |
OLD | NEW |