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 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 Expression argument = popForValue(); | 857 Expression argument = popForValue(); |
858 Expression receiver = popForValue(); | 858 Expression receiver = popForValue(); |
859 push(new KernelLogicalExpression(receiver, token.stringValue, argument)); | 859 push(new KernelLogicalExpression(receiver, token.stringValue, argument)); |
860 } | 860 } |
861 | 861 |
862 /// Handle `a ?? b`. | 862 /// Handle `a ?? b`. |
863 void doIfNull(Token token) { | 863 void doIfNull(Token token) { |
864 Expression b = popForValue(); | 864 Expression b = popForValue(); |
865 Expression a = popForValue(); | 865 Expression a = popForValue(); |
866 VariableDeclaration variable = new VariableDeclaration.forValue(a); | 866 VariableDeclaration variable = new VariableDeclaration.forValue(a); |
867 push(makeLet( | 867 push(new KernelIfNullExpression( |
868 variable, | 868 variable, |
869 new KernelConditionalExpression( | 869 new KernelConditionalExpression( |
870 buildIsNull(new VariableGet(variable), offsetForToken(token)), | 870 buildIsNull(new VariableGet(variable), offsetForToken(token)), |
871 b, | 871 b, |
872 new VariableGet(variable)))); | 872 new VariableGet(variable)))); |
873 } | 873 } |
874 | 874 |
875 /// Handle `a?.b(...)`. | 875 /// Handle `a?.b(...)`. |
876 void doIfNotNull(Token token) { | 876 void doIfNotNull(Token token) { |
877 IncompleteSend send = pop(); | 877 IncompleteSend send = pop(); |
(...skipping 2792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3670 if (starToken == null) { | 3670 if (starToken == null) { |
3671 return AsyncMarker.Async; | 3671 return AsyncMarker.Async; |
3672 } else { | 3672 } else { |
3673 assert(identical(starToken.stringValue, "*")); | 3673 assert(identical(starToken.stringValue, "*")); |
3674 return AsyncMarker.AsyncStar; | 3674 return AsyncMarker.AsyncStar; |
3675 } | 3675 } |
3676 } else { | 3676 } else { |
3677 return internalError("Unknown async modifier: $asyncToken"); | 3677 return internalError("Unknown async modifier: $asyncToken"); |
3678 } | 3678 } |
3679 } | 3679 } |
OLD | NEW |