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 2640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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, message); |
| 2661 statement.conditionStartOffset = leftParenthesis.next.offset; | |
| 2662 Token lastTokenInCondition = rightParenthesis.previous; | |
|
ahe
2017/06/16 07:39:42
We want to get rid of "previous". Could you do som
jensj
2017/06/16 07:43:29
I could. But:
1) I suppose an assert can be arbitr
ahe
2017/06/16 07:53:35
statement.conditionStartOffset = leftParenthesis.o
jensj
2017/06/16 09:28:25
Actually not -1 on the end as that would could off
| |
| 2663 statement.conditionEndOffset = | |
| 2664 lastTokenInCondition.offset + lastTokenInCondition.length; | |
| 2661 switch (kind) { | 2665 switch (kind) { |
| 2662 case Assert.Statement: | 2666 case Assert.Statement: |
| 2663 push(statement); | 2667 push(statement); |
| 2664 break; | 2668 break; |
| 2665 | 2669 |
| 2666 case Assert.Expression: | 2670 case Assert.Expression: |
| 2667 push(buildCompileTimeError("`assert` can't be used as an expression.")); | 2671 push(buildCompileTimeError("`assert` can't be used as an expression.")); |
| 2668 break; | 2672 break; |
| 2669 | 2673 |
| 2670 case Assert.Initializer: | 2674 case Assert.Initializer: |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3667 if (starToken == null) { | 3671 if (starToken == null) { |
| 3668 return AsyncMarker.Async; | 3672 return AsyncMarker.Async; |
| 3669 } else { | 3673 } else { |
| 3670 assert(identical(starToken.stringValue, "*")); | 3674 assert(identical(starToken.stringValue, "*")); |
| 3671 return AsyncMarker.AsyncStar; | 3675 return AsyncMarker.AsyncStar; |
| 3672 } | 3676 } |
| 3673 } else { | 3677 } else { |
| 3674 return internalError("Unknown async modifier: $asyncToken"); | 3678 return internalError("Unknown async modifier: $asyncToken"); |
| 3675 } | 3679 } |
| 3676 } | 3680 } |
| OLD | NEW |