| 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 2639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2650 // inInitializer should be false anyway. | 2650 // inInitializer should be false anyway. |
| 2651 inInitializer = false; | 2651 inInitializer = false; |
| 2652 } | 2652 } |
| 2653 | 2653 |
| 2654 @override | 2654 @override |
| 2655 void endAssert(Token assertKeyword, Assert kind, Token leftParenthesis, | 2655 void endAssert(Token assertKeyword, Assert kind, Token leftParenthesis, |
| 2656 Token commaToken, Token rightParenthesis, Token semicolonToken) { | 2656 Token commaToken, Token rightParenthesis, Token semicolonToken) { |
| 2657 debugEvent("Assert"); | 2657 debugEvent("Assert"); |
| 2658 Expression message = popForValueIfNotNull(commaToken); | 2658 Expression message = popForValueIfNotNull(commaToken); |
| 2659 Expression condition = popForValue(); | 2659 Expression condition = popForValue(); |
| 2660 AssertStatement statement = new AssertStatement(condition, message); | 2660 AssertStatement statement = new AssertStatement(condition, |
| 2661 conditionStartOffset: leftParenthesis.offset + 1, |
| 2662 conditionEndOffset: rightParenthesis.offset, |
| 2663 message: message); |
| 2661 switch (kind) { | 2664 switch (kind) { |
| 2662 case Assert.Statement: | 2665 case Assert.Statement: |
| 2663 push(statement); | 2666 push(statement); |
| 2664 break; | 2667 break; |
| 2665 | 2668 |
| 2666 case Assert.Expression: | 2669 case Assert.Expression: |
| 2667 push(buildCompileTimeError("`assert` can't be used as an expression.")); | 2670 push(buildCompileTimeError("`assert` can't be used as an expression.")); |
| 2668 break; | 2671 break; |
| 2669 | 2672 |
| 2670 case Assert.Initializer: | 2673 case Assert.Initializer: |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3667 if (starToken == null) { | 3670 if (starToken == null) { |
| 3668 return AsyncMarker.Async; | 3671 return AsyncMarker.Async; |
| 3669 } else { | 3672 } else { |
| 3670 assert(identical(starToken.stringValue, "*")); | 3673 assert(identical(starToken.stringValue, "*")); |
| 3671 return AsyncMarker.AsyncStar; | 3674 return AsyncMarker.AsyncStar; |
| 3672 } | 3675 } |
| 3673 } else { | 3676 } else { |
| 3674 return internalError("Unknown async modifier: $asyncToken"); | 3677 return internalError("Unknown async modifier: $asyncToken"); |
| 3675 } | 3678 } |
| 3676 } | 3679 } |
| OLD | NEW |