Skip to content

Conversation

@sunverwerth
Copy link
Contributor

Fixes #195

parseBreakOrContinueStatement now parses breakoutLevel as an Expression.
The additional check that the breakout level must be a positive integer has been moved into DiagnosticProvider.

@msftclas
Copy link

msftclas commented Sep 26, 2017

CLA assistant check
All CLA requirements met.

TokenKind::OctalLiteralToken,
TokenKind::IntegerLiteralToken
])
&& \intval($breakoutLevel->getText()) > 0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just cast to an int?

Copy link
Contributor Author

@sunverwerth sunverwerth Sep 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that works for anything but decimal numbers

PHP7.0.22:

php > echo '0xA'*1;
0
php > echo (int)'0xA';
0

@roblourens
Copy link
Member

roblourens commented Sep 27, 2017

Thanks! I think that parsing as an expression and running diagnostics is the right approach. We really need tests for DiagnosticsProvider...

@roblourens roblourens merged commit 754db66 into microsoft:master Sep 27, 2017
@sunverwerth
Copy link
Contributor Author

Yup, that's what I figured writing this.
Maybe similar to the spec tests, we could compare them to a known serialized diagnostics output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants