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_formal_parameter_builder; | 5 library fasta.kernel_formal_parameter_builder; |
6 | 6 |
7 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart' | 7 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart' |
8 show KernelVariableDeclaration; | 8 show KernelVariableDeclaration; |
9 | 9 |
10 import '../modifier.dart' show finalMask; | 10 import '../modifier.dart' show finalMask; |
(...skipping 22 matching lines...) Expand all Loading... |
33 KernelLibraryBuilder compilationUnit, | 33 KernelLibraryBuilder compilationUnit, |
34 this.charOffset) | 34 this.charOffset) |
35 : super(metadata, modifiers, type, name, hasThis, compilationUnit, | 35 : super(metadata, modifiers, type, name, hasThis, compilationUnit, |
36 charOffset); | 36 charOffset); |
37 | 37 |
38 KernelVariableDeclaration get target => declaration; | 38 KernelVariableDeclaration get target => declaration; |
39 | 39 |
40 KernelVariableDeclaration build(SourceLibraryBuilder library) { | 40 KernelVariableDeclaration build(SourceLibraryBuilder library) { |
41 if (declaration == null) { | 41 if (declaration == null) { |
42 declaration = new KernelVariableDeclaration(name, 0, | 42 declaration = new KernelVariableDeclaration(name, 0, |
43 type: type?.build(library), isFinal: isFinal, isConst: isConst) | 43 type: type?.build(library), |
| 44 isFinal: isFinal, |
| 45 isConst: isConst, |
| 46 isFieldFormal: hasThis) |
44 ..fileOffset = charOffset; | 47 ..fileOffset = charOffset; |
45 if (type == null && hasThis) { | 48 if (type == null && hasThis) { |
46 library.loader.typeInferenceEngine | 49 library.loader.typeInferenceEngine |
47 .recordInitializingFormal(declaration); | 50 .recordInitializingFormal(declaration); |
48 } | 51 } |
49 } | 52 } |
50 return declaration; | 53 return declaration; |
51 } | 54 } |
52 | 55 |
53 @override | 56 @override |
54 FormalParameterBuilder forFormalParameterInitializerScope() { | 57 FormalParameterBuilder forFormalParameterInitializerScope() { |
55 assert(declaration != null); | 58 assert(declaration != null); |
56 return !hasThis | 59 return !hasThis |
57 ? this | 60 ? this |
58 : (new KernelFormalParameterBuilder(metadata, modifiers | finalMask, | 61 : (new KernelFormalParameterBuilder(metadata, modifiers | finalMask, |
59 type, name, hasThis, parent, charOffset) | 62 type, name, hasThis, parent, charOffset) |
60 ..declaration = declaration); | 63 ..declaration = declaration); |
61 } | 64 } |
62 } | 65 } |
OLD | NEW |