| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 return throwNoSuchMethodError(plainNameForWrite, | 89 return throwNoSuchMethodError(plainNameForWrite, |
| 90 new Arguments(<Expression>[value]), uri, charOffset, coreTypes, | 90 new Arguments(<Expression>[value]), uri, charOffset, coreTypes, |
| 91 isSetter: true); | 91 isSetter: true); |
| 92 } | 92 } |
| 93 | 93 |
| 94 TreeNode doInvocation(int charOffset, Arguments arguments); | 94 TreeNode doInvocation(int charOffset, Arguments arguments); |
| 95 | 95 |
| 96 buildPropertyAccess(IncompleteSend send, bool isNullAware) { | 96 buildPropertyAccess(IncompleteSend send, bool isNullAware) { |
| 97 if (send is SendAccessor) { | 97 if (send is SendAccessor) { |
| 98 return buildMethodInvocation( | 98 return buildMethodInvocation( |
| 99 buildSimpleRead(), send.name, send.arguments, charOffset, | 99 buildSimpleRead(), send.name, send.arguments, send.charOffset, |
| 100 isNullAware: isNullAware); | 100 isNullAware: isNullAware); |
| 101 } else { | 101 } else { |
| 102 return PropertyAccessor.make(helper, charOffset, buildSimpleRead(), | 102 return PropertyAccessor.make(helper, send.charOffset, buildSimpleRead(), |
| 103 send.name, null, null, isNullAware); | 103 send.name, null, null, isNullAware); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 Expression buildThrowNoSuchMethodError(Arguments arguments) { | 107 Expression buildThrowNoSuchMethodError(Arguments arguments) { |
| 108 bool isGetter = false; | 108 bool isGetter = false; |
| 109 if (arguments == null) { | 109 if (arguments == null) { |
| 110 arguments = new Arguments.empty(); | 110 arguments = new Arguments.empty(); |
| 111 isGetter = true; | 111 isGetter = true; |
| 112 } | 112 } |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 } else { | 512 } else { |
| 513 return new IndexAccessor.internal( | 513 return new IndexAccessor.internal( |
| 514 helper, charOffset, receiver, index, getter, setter); | 514 helper, charOffset, receiver, index, getter, setter); |
| 515 } | 515 } |
| 516 } | 516 } |
| 517 } | 517 } |
| 518 | 518 |
| 519 class PropertyAccessor extends kernel.PropertyAccessor with BuilderAccessor { | 519 class PropertyAccessor extends kernel.PropertyAccessor with BuilderAccessor { |
| 520 final BuilderHelper helper; | 520 final BuilderHelper helper; |
| 521 | 521 |
| 522 final int charOffset; | 522 PropertyAccessor.internal(this.helper, int charOffset, Expression receiver, |
| 523 | |
| 524 PropertyAccessor.internal(this.helper, this.charOffset, Expression receiver, | |
| 525 Name name, Member getter, Member setter) | 523 Name name, Member getter, Member setter) |
| 526 : super.internal(receiver, name, getter, setter); | 524 : super.internal(receiver, name, getter, setter, charOffset); |
| 527 | 525 |
| 528 String get plainNameForRead => name.name; | 526 String get plainNameForRead => name.name; |
| 529 | 527 |
| 530 bool get isThisPropertyAccessor => receiver is ThisExpression; | 528 bool get isThisPropertyAccessor => receiver is ThisExpression; |
| 531 | 529 |
| 532 Expression doInvocation(int charOffset, Arguments arguments) { | 530 Expression doInvocation(int charOffset, Arguments arguments) { |
| 533 return buildMethodInvocation(receiver, name, arguments, charOffset); | 531 return buildMethodInvocation(receiver, name, arguments, charOffset); |
| 534 } | 532 } |
| 535 | 533 |
| 536 toString() => "PropertyAccessor()"; | 534 toString() => "PropertyAccessor()"; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 Expression doInvocation(int charOffset, Arguments arguments) { | 690 Expression doInvocation(int charOffset, Arguments arguments) { |
| 693 return internalError("Not implemented yet."); | 691 return internalError("Not implemented yet."); |
| 694 } | 692 } |
| 695 | 693 |
| 696 toString() => "NullAwarePropertyAccessor()"; | 694 toString() => "NullAwarePropertyAccessor()"; |
| 697 } | 695 } |
| 698 | 696 |
| 699 class VariableAccessor extends kernel.VariableAccessor with BuilderAccessor { | 697 class VariableAccessor extends kernel.VariableAccessor with BuilderAccessor { |
| 700 final BuilderHelper helper; | 698 final BuilderHelper helper; |
| 701 | 699 |
| 702 final int charOffset; | 700 VariableAccessor(this.helper, int charOffset, VariableDeclaration variable, |
| 703 | |
| 704 VariableAccessor(this.helper, this.charOffset, VariableDeclaration variable, | |
| 705 [DartType promotedType]) | 701 [DartType promotedType]) |
| 706 : super.internal(variable, promotedType); | 702 : super.internal(variable, charOffset, promotedType); |
| 707 | 703 |
| 708 String get plainNameForRead => variable.name; | 704 String get plainNameForRead => variable.name; |
| 709 | 705 |
| 710 Expression doInvocation(int charOffset, Arguments arguments) { | 706 Expression doInvocation(int charOffset, Arguments arguments) { |
| 711 return buildMethodInvocation( | 707 return buildMethodInvocation( |
| 712 buildSimpleRead(), new Name("call"), arguments, charOffset); | 708 buildSimpleRead(), new Name("call"), arguments, charOffset); |
| 713 } | 709 } |
| 714 | 710 |
| 715 toString() => "VariableAccessor()"; | 711 toString() => "VariableAccessor()"; |
| 716 } | 712 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 buildIsNull(new VariableGet(variable)), | 745 buildIsNull(new VariableGet(variable)), |
| 750 new NullLiteral(), | 746 new NullLiteral(), |
| 751 new MethodInvocation(new VariableGet(variable), name, arguments) | 747 new MethodInvocation(new VariableGet(variable), name, arguments) |
| 752 ..fileOffset = charOffset, | 748 ..fileOffset = charOffset, |
| 753 const DynamicType())); | 749 const DynamicType())); |
| 754 } else { | 750 } else { |
| 755 return new MethodInvocation(receiver, name, arguments) | 751 return new MethodInvocation(receiver, name, arguments) |
| 756 ..fileOffset = charOffset; | 752 ..fileOffset = charOffset; |
| 757 } | 753 } |
| 758 } | 754 } |
| OLD | NEW |