WSL should support ++, --, +=, and all of those things
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Sep 2017 20:36:27 +0000 (20:36 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Sep 2017 20:36:27 +0000 (20:36 +0000)
commit793cf32f537d47709b46f23fd9965aa4fd49b079
tree206ffe843d40dac1c15b41a647d2fc398dffc8eb
parentb8eb5c12b866280c9e56b36ab928b55fb83e806e
WSL should support ++, --, +=, and all of those things
https://bugs.webkit.org/show_bug.cgi?id=176975

Reviewed by Myles Maxfield.

This adds an internal AST construct called LetExpression, that allows us to anonymously capture
a value. This change uses LetExpression to implement prefix and suffix ++/-- and all of the
+=/-=/etc.

* WebGPUShadingLanguageRI/All.js:
* WebGPUShadingLanguageRI/Checker.js:
* WebGPUShadingLanguageRI/EBufferBuilder.js:
(EBufferBuilder.prototype.visitVariableDecl):
(EBufferBuilder.prototype.visitLetExpression):
(EBufferBuilder):
* WebGPUShadingLanguageRI/Evaluator.js:
(Evaluator.prototype.visitLetExpression):
* WebGPUShadingLanguageRI/LetExpression.js: Added.
(LetExpression):
(LetExpression.prototype.get origin):
(LetExpression.prototype.get name):
(LetExpression.prototype.toString):
* WebGPUShadingLanguageRI/Lexer.js:
(Lexer.prototype.next):
(Lexer):
* WebGPUShadingLanguageRI/NameResolver.js:
(NameResolver.prototype.visitProtocolDecl):
* WebGPUShadingLanguageRI/Parse.js:
(isCallExpression):
(finishParsingPostIncrement):
(parsePossibleSuffix):
(finishParsingPreIncrement):
(parsePreIncrement):
(parsePossiblePrefix):
(parsePossibleAssignment):
(parsePostIncrement):
(parseEffectfulExpression):
* WebGPUShadingLanguageRI/Rewriter.js:
(Rewriter.prototype.visitFunctionLikeBlock):
(Rewriter.prototype.visitLetExpression):
(Rewriter):
* WebGPUShadingLanguageRI/StandardLibrary.js:
(int.operator):
(uint.operator):
* WebGPUShadingLanguageRI/Test.html:
* WebGPUShadingLanguageRI/Test.js:
(TEST_prefixPlusPlus):
(TEST_prefixPlusPlusResult):
(TEST_postfixPlusPlus):
(TEST_postfixPlusPlusResult):
(TEST_prefixMinusMinus):
(TEST_prefixMinusMinusResult):
(TEST_postfixMinusMinus):
(TEST_postfixMinusMinusResult):
(TEST_plusEquals):
(TEST_plusEqualsResult):
(TEST_minusEquals):
(TEST_minusEqualsResult):
(TEST_timesEquals):
(TEST_timesEqualsResult):
(TEST_divideEquals):
(TEST_divideEqualsResult):
* WebGPUShadingLanguageRI/Visitor.js:
(Visitor.prototype.visitProtocolDecl):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222108 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Tools/ChangeLog
Tools/WebGPUShadingLanguageRI/All.js
Tools/WebGPUShadingLanguageRI/Checker.js
Tools/WebGPUShadingLanguageRI/EBufferBuilder.js
Tools/WebGPUShadingLanguageRI/Evaluator.js
Tools/WebGPUShadingLanguageRI/LetExpression.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/Lexer.js
Tools/WebGPUShadingLanguageRI/NameResolver.js
Tools/WebGPUShadingLanguageRI/Parse.js
Tools/WebGPUShadingLanguageRI/Rewriter.js
Tools/WebGPUShadingLanguageRI/StandardLibrary.js
Tools/WebGPUShadingLanguageRI/Test.html
Tools/WebGPUShadingLanguageRI/Test.js
Tools/WebGPUShadingLanguageRI/Visitor.js