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, send.charOffset, send.name, getter, setter); | 219 helper, charOffset, send.name, getter, setter); |
220 } else { | 220 } else { |
221 return new ThisPropertyAccessor( | 221 return new ThisPropertyAccessor( |
222 helper, send.charOffset, send.name, null, null); | 222 helper, 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 } | 585 } |
586 } | 586 } |
587 | 587 |
588 toString() => "StaticAccessor()"; | 588 toString() => "StaticAccessor()"; |
589 } | 589 } |
590 | 590 |
591 class SuperPropertyAccessor extends kernel.SuperPropertyAccessor | 591 class SuperPropertyAccessor extends kernel.SuperPropertyAccessor |
592 with BuilderAccessor { | 592 with BuilderAccessor { |
593 final BuilderHelper helper; | 593 final BuilderHelper helper; |
594 | 594 |
| 595 final int charOffset; |
| 596 |
595 SuperPropertyAccessor( | 597 SuperPropertyAccessor( |
596 this.helper, int charOffset, Name name, Member getter, Member setter) | 598 this.helper, this.charOffset, Name name, Member getter, Member setter) |
597 : super(name, getter, setter, charOffset); | 599 : super(name, getter, setter); |
598 | 600 |
599 String get plainNameForRead => name.name; | 601 String get plainNameForRead => name.name; |
600 | 602 |
601 Expression doInvocation(int charOffset, Arguments arguments) { | 603 Expression doInvocation(int charOffset, Arguments arguments) { |
602 if (getter == null || isFieldOrGetter(getter)) { | 604 if (getter == null || isFieldOrGetter(getter)) { |
603 return buildMethodInvocation( | 605 return buildMethodInvocation( |
604 buildSimpleRead(), new Name("call"), arguments, charOffset); | 606 buildSimpleRead(), new Name("call"), arguments, charOffset); |
605 } else { | 607 } else { |
606 return new DirectMethodInvocation(new ThisExpression(), getter, arguments) | 608 return new DirectMethodInvocation(new ThisExpression(), getter, arguments) |
607 ..fileOffset = charOffset; | 609 ..fileOffset = charOffset; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 buildIsNull(new VariableGet(variable)), | 756 buildIsNull(new VariableGet(variable)), |
755 new NullLiteral(), | 757 new NullLiteral(), |
756 new MethodInvocation(new VariableGet(variable), name, arguments) | 758 new MethodInvocation(new VariableGet(variable), name, arguments) |
757 ..fileOffset = charOffset, | 759 ..fileOffset = charOffset, |
758 const DynamicType())); | 760 const DynamicType())); |
759 } else { | 761 } else { |
760 return new MethodInvocation(receiver, name, arguments) | 762 return new MethodInvocation(receiver, name, arguments) |
761 ..fileOffset = charOffset; | 763 ..fileOffset = charOffset; |
762 } | 764 } |
763 } | 765 } |
OLD | NEW |