WSL should check unreachable code and no returns
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Sep 2017 02:33:46 +0000 (02:33 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Sep 2017 02:33:46 +0000 (02:33 +0000)
commitffb41cfe9f660093bbceb06da5b049df0cfd14ae
tree756984343ad87557b11cb86663d7e87df25b5617
parentefe8752e0db0427b6fd16d5fe9556112608942ba
WSL should check unreachable code and no returns
https://bugs.webkit.org/show_bug.cgi?id=176262

Reviewed by Myles Maxfield.

This adds phases to check whether non-void functions return and whether there is any code after
a return in any block. Added tests for simple versions of both of those things. We cannot add
more complex versions until we support control flow statements.

* WebGPUShadingLanguageRI/All.js:
* WebGPUShadingLanguageRI/CheckReturns.js: Added.
(checkReturns):
* WebGPUShadingLanguageRI/CheckUnreachableCode.js: Added.
(checkUnreachableCode):
* WebGPUShadingLanguageRI/Parse.js:
(parseReturn):
* WebGPUShadingLanguageRI/Prepare.js:
(prepare):
* WebGPUShadingLanguageRI/ReturnChecker.js: Added.
(ReturnChecker.prototype.visitFuncDef):
(ReturnChecker.prototype.visitBlock):
(ReturnChecker.prototype.visitReturn):
(ReturnChecker):
* WebGPUShadingLanguageRI/Test.js:
(TEST_simpleNoReturn):
* WebGPUShadingLanguageRI/UnreachableCodeChecker.js: Added.
(UnreachableCodeChecker.prototype.visitBlock):
(UnreachableCodeChecker):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221513 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Tools/ChangeLog
Tools/WebGPUShadingLanguageRI/All.js
Tools/WebGPUShadingLanguageRI/CheckReturns.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/CheckUnreachableCode.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/Parse.js
Tools/WebGPUShadingLanguageRI/Prepare.js
Tools/WebGPUShadingLanguageRI/ReturnChecker.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/Test.js
Tools/WebGPUShadingLanguageRI/UnreachableCodeChecker.js [new file with mode: 0644]