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.builder_accessors; | 5 library fasta.builder_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; | 9 import 'frontend_accessors.dart' show Accessor; |
10 | 10 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 // Notice that 'this' or 'super' can't be null. So we can ignore the | 209 // Notice that 'this' or 'super' can't be null. So we can ignore the |
210 // value of [isNullAware]. | 210 // value of [isNullAware]. |
211 MethodInvocation result = buildMethodInvocation( | 211 MethodInvocation result = buildMethodInvocation( |
212 new ThisExpression(), send.name, send.arguments, charOffset); | 212 new ThisExpression(), send.name, send.arguments, charOffset); |
213 return isSuper ? helper.toSuperMethodInvocation(result) : result; | 213 return isSuper ? helper.toSuperMethodInvocation(result) : result; |
214 } else { | 214 } else { |
215 if (isSuper) { | 215 if (isSuper) { |
216 Member getter = helper.lookupSuperMember(send.name); | 216 Member getter = helper.lookupSuperMember(send.name); |
217 Member setter = helper.lookupSuperMember(send.name, isSetter: true); | 217 Member setter = helper.lookupSuperMember(send.name, isSetter: true); |
218 return new SuperPropertyAccessor( | 218 return new SuperPropertyAccessor( |
219 helper, charOffset, send.name, getter, setter); | 219 helper, send.charOffset, send.name, getter, setter); |
220 } else { | 220 } else { |
221 return new ThisPropertyAccessor( | 221 return new ThisPropertyAccessor( |
222 helper, charOffset, send.name, null, null); | 222 helper, send.charOffset, send.name, null, null); |
223 } | 223 } |
224 } | 224 } |
225 } | 225 } |
226 | 226 |
227 doInvocation(int charOffset, Arguments arguments) { | 227 doInvocation(int charOffset, Arguments arguments) { |
228 if (isInitializer) { | 228 if (isInitializer) { |
229 return buildConstructorInitializer(charOffset, new Name(""), arguments); | 229 return buildConstructorInitializer(charOffset, new Name(""), arguments); |
230 } else { | 230 } else { |
231 return buildMethodInvocation( | 231 return buildMethodInvocation( |
232 new ThisExpression(), new Name("call"), arguments, charOffset); | 232 new ThisExpression(), new Name("call"), arguments, charOffset); |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 } | 588 } |
589 } | 589 } |
590 | 590 |
591 toString() => "StaticAccessor()"; | 591 toString() => "StaticAccessor()"; |
592 } | 592 } |
593 | 593 |
594 class SuperPropertyAccessor extends kernel.SuperPropertyAccessor | 594 class SuperPropertyAccessor extends kernel.SuperPropertyAccessor |
595 with BuilderAccessor { | 595 with BuilderAccessor { |
596 final BuilderHelper helper; | 596 final BuilderHelper helper; |
597 | 597 |
598 final int charOffset; | |
599 | |
600 SuperPropertyAccessor( | 598 SuperPropertyAccessor( |
601 this.helper, this.charOffset, Name name, Member getter, Member setter) | 599 this.helper, int charOffset, Name name, Member getter, Member setter) |
602 : super(name, getter, setter); | 600 : super(name, getter, setter, charOffset); |
603 | 601 |
604 String get plainNameForRead => name.name; | 602 String get plainNameForRead => name.name; |
605 | 603 |
606 Expression doInvocation(int charOffset, Arguments arguments) { | 604 Expression doInvocation(int charOffset, Arguments arguments) { |
607 if (getter == null || isFieldOrGetter(getter)) { | 605 if (getter == null || isFieldOrGetter(getter)) { |
608 return buildMethodInvocation( | 606 return buildMethodInvocation( |
609 buildSimpleRead(), new Name("call"), arguments, charOffset); | 607 buildSimpleRead(), new Name("call"), arguments, charOffset); |
610 } else { | 608 } else { |
611 return new DirectMethodInvocation(new ThisExpression(), getter, arguments) | 609 return new DirectMethodInvocation(new ThisExpression(), getter, arguments) |
612 ..fileOffset = charOffset; | 610 ..fileOffset = charOffset; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 buildIsNull(new VariableGet(variable)), | 755 buildIsNull(new VariableGet(variable)), |
758 new NullLiteral(), | 756 new NullLiteral(), |
759 new MethodInvocation(new VariableGet(variable), name, arguments) | 757 new MethodInvocation(new VariableGet(variable), name, arguments) |
760 ..fileOffset = charOffset, | 758 ..fileOffset = charOffset, |
761 const DynamicType())); | 759 const DynamicType())); |
762 } else { | 760 } else { |
763 return new MethodInvocation(receiver, name, arguments) | 761 return new MethodInvocation(receiver, name, arguments) |
764 ..fileOffset = charOffset; | 762 ..fileOffset = charOffset; |
765 } | 763 } |
766 } | 764 } |
OLD | NEW |