Chromium Code Reviews| 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.body_builder; | 5 library fasta.body_builder; |
| 6 | 6 |
| 7 import '../fasta_codes.dart' | 7 import '../fasta_codes.dart' |
| 8 show | 8 show |
| 9 FastaMessage, | 9 FastaMessage, |
| 10 codeConstFieldWithoutInitializer, | 10 codeConstFieldWithoutInitializer, |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 890 } | 890 } |
| 891 | 891 |
| 892 @override | 892 @override |
| 893 Expression toSuperMethodInvocation(MethodInvocation node) { | 893 Expression toSuperMethodInvocation(MethodInvocation node) { |
| 894 Member target = lookupSuperMember(node.name); | 894 Member target = lookupSuperMember(node.name); |
| 895 bool isNoSuchMethod = target == null; | 895 bool isNoSuchMethod = target == null; |
| 896 if (target is Procedure) { | 896 if (target is Procedure) { |
| 897 if (!target.isAccessor) { | 897 if (!target.isAccessor) { |
| 898 if (areArgumentsCompatible(target.function, node.arguments)) { | 898 if (areArgumentsCompatible(target.function, node.arguments)) { |
| 899 Expression result = new KernelDirectMethodInvocation( | 899 Expression result = new KernelDirectMethodInvocation( |
| 900 new ThisExpression()..fileOffset = node.fileOffset, | 900 new KernelThisExpression()..fileOffset = node.fileOffset, |
| 901 target, | 901 target, |
| 902 node.arguments); | 902 node.arguments) |
| 903 ..fileOffset = node.fileOffset; | |
| 903 // TODO(ahe): Use [DirectMethodInvocation] when possible, that is, | 904 // TODO(ahe): Use [DirectMethodInvocation] when possible, that is, |
| 904 // remove the next line: | 905 // remove the next line: |
| 905 result = | 906 result = |
| 906 new KernelSuperMethodInvocation(node.name, node.arguments, null); | 907 new KernelSuperMethodInvocation(node.name, node.arguments, target) |
|
Paul Berry
2017/06/26 18:57:55
Peter, can you confirm that passing `target` is th
Siggi Cherem (dart-lang)
2017/06/26 19:47:53
DBC - the answer might change in the near future w
Paul Berry
2017/06/27 20:50:17
Thanks for the heads up. I'm adding a test case t
| |
| 908 ..fileOffset = node.fileOffset; | |
| 907 return result; | 909 return result; |
| 908 } else { | 910 } else { |
| 909 isNoSuchMethod = true; | 911 isNoSuchMethod = true; |
| 910 } | 912 } |
| 911 } | 913 } |
| 912 } | 914 } |
| 913 if (isNoSuchMethod) { | 915 if (isNoSuchMethod) { |
| 914 return invokeSuperNoSuchMethod( | 916 return invokeSuperNoSuchMethod( |
| 915 node.name.name, node.arguments, node.fileOffset); | 917 node.name.name, node.arguments, node.fileOffset); |
| 916 } | 918 } |
| 917 Expression receiver = new KernelDirectPropertyGet( | 919 Expression receiver = new KernelDirectPropertyGet( |
| 918 new ThisExpression()..fileOffset = node.fileOffset, target); | 920 new KernelThisExpression()..fileOffset = node.fileOffset, target); |
| 919 // TODO(ahe): Use [DirectPropertyGet] when possible, that is, remove the | 921 // TODO(ahe): Use [DirectPropertyGet] when possible, that is, remove the |
| 920 // next line: | 922 // next line: |
| 921 receiver = new KernelSuperPropertyGet(node.name, target); | 923 receiver = new KernelSuperPropertyGet(node.name, target); |
| 922 return buildMethodInvocation( | 924 return buildMethodInvocation( |
| 923 receiver, callName, node.arguments, node.fileOffset, | 925 receiver, callName, node.arguments, node.fileOffset, |
| 924 isImplicitCall: true); | 926 isImplicitCall: true); |
| 925 } | 927 } |
| 926 | 928 |
| 927 bool areArgumentsCompatible(FunctionNode function, Arguments arguments) { | 929 bool areArgumentsCompatible(FunctionNode function, Arguments arguments) { |
| 928 // TODO(ahe): Implement this. | 930 // TODO(ahe): Implement this. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 985 isFinal: true) | 987 isFinal: true) |
| 986 ..fileOffset = charOffset; | 988 ..fileOffset = charOffset; |
| 987 arguments = new Arguments(<Expression>[ | 989 arguments = new Arguments(<Expression>[ |
| 988 new VariableGet(value)..fileOffset = arguments.fileOffset | 990 new VariableGet(value)..fileOffset = arguments.fileOffset |
| 989 ]); | 991 ]); |
| 990 } | 992 } |
| 991 Expression result = new SuperMethodInvocation( | 993 Expression result = new SuperMethodInvocation( |
| 992 noSuchMethodName, | 994 noSuchMethodName, |
| 993 new Arguments(<Expression>[ | 995 new Arguments(<Expression>[ |
| 994 library.loader.instantiateInvocation( | 996 library.loader.instantiateInvocation( |
| 995 new ThisExpression()..fileOffset = charOffset, | 997 new KernelThisExpression()..fileOffset = charOffset, |
| 996 name, | 998 name, |
| 997 arguments, | 999 arguments, |
| 998 charOffset, | 1000 charOffset, |
| 999 true) | 1001 true) |
| 1000 ]) | 1002 ]) |
| 1001 ..fileOffset = arguments.fileOffset); | 1003 ..fileOffset = arguments.fileOffset); |
| 1002 if (isSetter) { | 1004 if (isSetter) { |
| 1003 result = new Let( | 1005 result = new Let( |
| 1004 value, | 1006 value, |
| 1005 new Let( | 1007 new Let( |
| (...skipping 2684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3690 if (starToken == null) { | 3692 if (starToken == null) { |
| 3691 return AsyncMarker.Async; | 3693 return AsyncMarker.Async; |
| 3692 } else { | 3694 } else { |
| 3693 assert(identical(starToken.stringValue, "*")); | 3695 assert(identical(starToken.stringValue, "*")); |
| 3694 return AsyncMarker.AsyncStar; | 3696 return AsyncMarker.AsyncStar; |
| 3695 } | 3697 } |
| 3696 } else { | 3698 } else { |
| 3697 return internalError("Unknown async modifier: $asyncToken"); | 3699 return internalError("Unknown async modifier: $asyncToken"); |
| 3698 } | 3700 } |
| 3699 } | 3701 } |
| OLD | NEW |