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.fasta_accessors; | 5 library fasta.fasta_accessors; |
6 | 6 |
7 export 'frontend_accessors.dart' show wrapInvalid; | 7 export 'frontend_accessors.dart' show wrapInvalid; |
8 | 8 |
9 import 'frontend_accessors.dart' show Accessor, buildIsNull, makeLet; | 9 import 'frontend_accessors.dart' show Accessor, buildIsNull, makeLet; |
10 | 10 |
11 import 'package:front_end/src/fasta/builder/ast_factory.dart' show AstFactory; | |
12 | |
13 import 'package:front_end/src/fasta/type_inference/type_promotion.dart' | |
14 show TypePromoter; | |
15 | |
11 import 'package:kernel/ast.dart'; | 16 import 'package:kernel/ast.dart'; |
12 | 17 |
13 import '../errors.dart' show internalError; | 18 import '../errors.dart' show internalError; |
14 | 19 |
15 import '../scope.dart' show AccessErrorBuilder, ProblemBuilder, Scope; | 20 import '../scope.dart' show AccessErrorBuilder, ProblemBuilder, Scope; |
16 | 21 |
17 import 'frontend_accessors.dart' as kernel | 22 import 'frontend_accessors.dart' as kernel |
18 show | 23 show |
19 IndexAccessor, | 24 IndexAccessor, |
20 NullAwarePropertyAccessor, | 25 NullAwarePropertyAccessor, |
21 PropertyAccessor, | 26 PropertyAccessor, |
22 ReadOnlyAccessor, | 27 ReadOnlyAccessor, |
23 StaticAccessor, | 28 StaticAccessor, |
24 SuperIndexAccessor, | 29 SuperIndexAccessor, |
25 SuperPropertyAccessor, | 30 SuperPropertyAccessor, |
26 ThisIndexAccessor, | 31 ThisIndexAccessor, |
27 ThisPropertyAccessor, | 32 ThisPropertyAccessor, |
28 VariableAccessor; | 33 VariableAccessor; |
29 | 34 |
30 import 'kernel_builder.dart' | 35 import 'kernel_builder.dart' |
31 show Builder, KernelClassBuilder, PrefixBuilder, TypeDeclarationBuilder; | 36 show Builder, KernelClassBuilder, PrefixBuilder, TypeDeclarationBuilder; |
32 | 37 |
33 import '../names.dart' show callName; | 38 import '../names.dart' show callName; |
34 | 39 |
35 abstract class BuilderHelper { | 40 abstract class BuilderHelper { |
ahe
2017/04/24 16:47:16
BTW: If you have a suggestion for a better name fo
Paul Berry
2017/04/24 18:20:30
Ok, thanks. So far I don't have any ideas.
| |
36 Uri get uri; | 41 Uri get uri; |
37 | 42 |
43 TypePromoter get typePromoter; | |
44 | |
45 int get functionNestingLevel; | |
46 | |
47 AstFactory get astFactory; | |
48 | |
38 Constructor lookupConstructor(Name name, {bool isSuper}); | 49 Constructor lookupConstructor(Name name, {bool isSuper}); |
39 | 50 |
40 Expression toSuperMethodInvocation(MethodInvocation node); | 51 Expression toSuperMethodInvocation(MethodInvocation node); |
41 | 52 |
42 Expression toValue(node); | 53 Expression toValue(node); |
43 | 54 |
44 Member lookupSuperMember(Name name, {bool isSetter: false}); | 55 Member lookupSuperMember(Name name, {bool isSetter: false}); |
45 | 56 |
46 scopeLookup(Scope scope, String name, int offset, | 57 scopeLookup(Scope scope, String name, int offset, |
47 {bool isQualified: false, PrefixBuilder prefix}); | 58 {bool isQualified: false, PrefixBuilder prefix}); |
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
802 String get plainNameForRead => name.name; | 813 String get plainNameForRead => name.name; |
803 | 814 |
804 Expression doInvocation(int offset, Arguments arguments) { | 815 Expression doInvocation(int offset, Arguments arguments) { |
805 return internalError("Not implemented yet."); | 816 return internalError("Not implemented yet."); |
806 } | 817 } |
807 | 818 |
808 toString() => "NullAwarePropertyAccessor()"; | 819 toString() => "NullAwarePropertyAccessor()"; |
809 } | 820 } |
810 | 821 |
811 class VariableAccessor extends kernel.VariableAccessor with FastaAccessor { | 822 class VariableAccessor extends kernel.VariableAccessor with FastaAccessor { |
823 @override | |
812 final BuilderHelper helper; | 824 final BuilderHelper helper; |
813 | 825 |
814 VariableAccessor(this.helper, int offset, VariableDeclaration variable, | 826 VariableAccessor(this.helper, int offset, VariableDeclaration variable, |
815 [DartType promotedType]) | 827 [DartType promotedType]) |
816 : super(variable, promotedType, offset); | 828 : super(variable, promotedType, offset); |
817 | 829 |
818 String get plainNameForRead => variable.name; | 830 String get plainNameForRead => variable.name; |
819 | 831 |
820 Expression doInvocation(int offset, Arguments arguments) { | 832 Expression doInvocation(int offset, Arguments arguments) { |
821 // Normally the offset is at the start of the token, but in this case, | 833 // Normally the offset is at the start of the token, but in this case, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
892 new ConditionalExpression( | 904 new ConditionalExpression( |
893 buildIsNull(new VariableGet(variable)), | 905 buildIsNull(new VariableGet(variable)), |
894 new NullLiteral(), | 906 new NullLiteral(), |
895 new MethodInvocation(new VariableGet(variable), name, arguments) | 907 new MethodInvocation(new VariableGet(variable), name, arguments) |
896 ..fileOffset = offset, | 908 ..fileOffset = offset, |
897 const DynamicType())); | 909 const DynamicType())); |
898 } else { | 910 } else { |
899 return new MethodInvocation(receiver, name, arguments)..fileOffset = offset; | 911 return new MethodInvocation(receiver, name, arguments)..fileOffset = offset; |
900 } | 912 } |
901 } | 913 } |
OLD | NEW |