WSL should be able to run a program that uses generics
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Aug 2017 19:33:35 +0000 (19:33 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Aug 2017 19:33:35 +0000 (19:33 +0000)
commit7b19829f1d075613c00c368424c311e6d882990d
treeafb915d884c840eab495ef04280f46ec6b20f32d
parent9daad8eda5c645abb9bf84def5af6a7a437ac8f4
WSL should be able to run a program that uses generics
https://bugs.webkit.org/show_bug.cgi?id=176152

Reviewed by Keith Miller.

This fixes the WSL parser and type checker to the point that we can:

- Parse a function call!
- Type check a generic function call with an inferred type parameter.
- Instantiate a generic function.
- Inline a function call.
- Evaluate an inlined function call.

This also changes the test suite so that it's a little nicer to add new tests. Functions whose
names start with "TEST_" are tests.

* WebGPUShadingLanguageRI/Checker.js:
(Checker.prototype.visitProtocolDecl.set throw):
* WebGPUShadingLanguageRI/EBufferBuilder.js:
(EBufferBuilder.prototype.visitFuncParameter):
(EBufferBuilder):
* WebGPUShadingLanguageRI/Evaluator.js:
(Evaluator.prototype.visitFunctionLikeBlock):
* WebGPUShadingLanguageRI/FuncDef.js:
(FuncDef.prototype.toString):
(FuncDef):
* WebGPUShadingLanguageRI/FuncInstantiator.js:
(FuncInstantiator.prototype.getUnique):
(FuncInstantiator):
* WebGPUShadingLanguageRI/Inliner.js:
(Inliner.prototype.visitCallExpression):
(Inliner):
* WebGPUShadingLanguageRI/Lexer.js:
(Lexer):
* WebGPUShadingLanguageRI/NameContext.js:
(NameContext):
(NameContext.prototype.add):
(NameContext.prototype.get let):
(NameContext.prototype.defineAll):
(NameContext.get intrinsics): Deleted.
(NameContext.set program): Deleted.
(NameContext.get program): Deleted.
* WebGPUShadingLanguageRI/NameResolver.js:
(NameResolver.prototype.visitProgram):
* WebGPUShadingLanguageRI/Parse.js:
(parseTerm):
(parsePossibleSuffix):
(genericParseCommaExpression):
(parseReturn):
* WebGPUShadingLanguageRI/Program.js:
(Program.prototype.resolveFuncOverload):
* WebGPUShadingLanguageRI/ProtocolDecl.js:
(ProtocolDecl.prototype.inherits):
* WebGPUShadingLanguageRI/ResolveOverloadImpl.js:
(resolveOverloadImpl):
* WebGPUShadingLanguageRI/Rewriter.js:
(Rewriter.prototype.visitFuncParameter):
(Rewriter.prototype.visitCallExpression):
(Rewriter.prototype._map): Deleted.
* WebGPUShadingLanguageRI/Test.js:
(checkInt):
(TEST_add1):
(TEST_simpleGeneric):
(let.s.in.this.s.startsWith):
(load): Deleted.
* WebGPUShadingLanguageRI/TypeVariable.js:
(TypeVariable.prototype.typeVariableUnify):
* WebGPUShadingLanguageRI/UnificationContext.js:
(UnificationContext.prototype.union):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221434 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
Tools/ChangeLog
Tools/WebGPUShadingLanguageRI/Checker.js
Tools/WebGPUShadingLanguageRI/EBufferBuilder.js
Tools/WebGPUShadingLanguageRI/Evaluator.js
Tools/WebGPUShadingLanguageRI/FuncDef.js
Tools/WebGPUShadingLanguageRI/FuncInstantiator.js
Tools/WebGPUShadingLanguageRI/Inliner.js
Tools/WebGPUShadingLanguageRI/Lexer.js
Tools/WebGPUShadingLanguageRI/NameContext.js
Tools/WebGPUShadingLanguageRI/NameResolver.js
Tools/WebGPUShadingLanguageRI/Parse.js
Tools/WebGPUShadingLanguageRI/Program.js
Tools/WebGPUShadingLanguageRI/ProtocolDecl.js
Tools/WebGPUShadingLanguageRI/ResolveOverloadImpl.js
Tools/WebGPUShadingLanguageRI/Rewriter.js
Tools/WebGPUShadingLanguageRI/Test.js
Tools/WebGPUShadingLanguageRI/TypeVariable.js
Tools/WebGPUShadingLanguageRI/UnificationContext.js