WSL Substitution should probably wrap type variables of substituted types rather...
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Sep 2017 22:53:36 +0000 (22:53 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Sep 2017 22:53:36 +0000 (22:53 +0000)
commit12f5394e0e1cc7c78f24a00c143dc6a06e5e5745
tree9ce419606e0031ce6dd76719bac4ccc4730c7409
parentbf667cf40dfd2b328584c64379044cd1265296bc
WSL Substitution should probably wrap type variables of substituted types rather than just wrapping the whole type
https://bugs.webkit.org/show_bug.cgi?id=176677

Reviewed by Mylex Maxfield.

This adds a checker that verifies that all type references and variable references are wrapped.

Then this fixes errors found by that checker by making Substitution auto-wrap replacements rather than
manually wrapping the outer type (for types) and cloning (for values).

* WebGPUShadingLanguageRI/All.js:
* WebGPUShadingLanguageRI/AutoWrapper.js: Added.
(AutoWrapper.prototype.visitVariableRef):
(AutoWrapper.prototype.visitTypeRef):
(AutoWrapper.prototype.visitConstexprTypeParameter):
(AutoWrapper.prototype.visitFuncParameter):
(AutoWrapper.prototype.visitVariableDecl):
(AutoWrapper.prototype.visitStructType):
(AutoWrapper.prototype.visitNativeType):
(AutoWrapper):
* WebGPUShadingLanguageRI/CheckWrapped.js:
(checkExpressionWrapped):
(checkProgramWrapped):
(checkWrapped): Deleted.
* WebGPUShadingLanguageRI/Checker.js:
* WebGPUShadingLanguageRI/ExpressionFinder.js: Added.
(ExpressionFinder):
(ExpressionFinder.prototype.visitFunc):
(ExpressionFinder.prototype.visitFuncParameter):
(ExpressionFinder.prototype.visitConstexprTypeParameter):
(ExpressionFinder.prototype.visitAssignment):
(ExpressionFinder.prototype.visitCallExpression):
(ExpressionFinder.prototype.visitReturn):
(ExpressionFinder.prototype.visitWhileLoop):
(ExpressionFinder.prototype.visitDoWhileLoop):
(ExpressionFinder.prototype.visitIfStatement):
(ExpressionFinder.prototype.visitForLoop):
(ExpressionFinder.prototype.visitVariableDecl):
* WebGPUShadingLanguageRI/NativeFuncInstance.js:
(NativeFuncInstance):
* WebGPUShadingLanguageRI/Node.js:
(Node.prototype.substituteToUnification):
(Node):
(Node.prototype.clone): Deleted.
* WebGPUShadingLanguageRI/Prepare.js:
(prepare):
* WebGPUShadingLanguageRI/StructLayoutBuilder.js:
(StructLayoutBuilder.prototype.visitReferenceType):
(StructLayoutBuilder.prototype.visitField):
(StructLayoutBuilder):
* WebGPUShadingLanguageRI/Substitution.js:
(Substitution):
(Substitution.prototype.visitTypeRef):
(Substitution.prototype.visitVariableRef):
* WebGPUShadingLanguageRI/Test.html:
* WebGPUShadingLanguageRI/Test.js:
(TEST_chainConstexpr):
(TEST_chainGeneric):
(TEST_chainStruct):
(TEST_chainStructInvalid):
* WebGPUShadingLanguageRI/Visitor.js:
(Visitor.prototype.visitNativeTypeInstance):
* WebGPUShadingLanguageRI/WrapChecker.js:
(WrapChecker.prototype._foundUnwrapped.originString):
(WrapChecker.prototype._foundUnwrapped):
(WrapChecker):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221888 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
Tools/ChangeLog
Tools/WebGPUShadingLanguageRI/All.js
Tools/WebGPUShadingLanguageRI/AutoWrapper.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/CheckWrapped.js
Tools/WebGPUShadingLanguageRI/Checker.js
Tools/WebGPUShadingLanguageRI/ExpressionFinder.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/NativeFuncInstance.js
Tools/WebGPUShadingLanguageRI/Node.js
Tools/WebGPUShadingLanguageRI/Prepare.js
Tools/WebGPUShadingLanguageRI/StructLayoutBuilder.js
Tools/WebGPUShadingLanguageRI/Substitution.js
Tools/WebGPUShadingLanguageRI/Test.html
Tools/WebGPUShadingLanguageRI/Test.js
Tools/WebGPUShadingLanguageRI/Visitor.js
Tools/WebGPUShadingLanguageRI/WrapChecker.js