Summary: | [WHLSL] Add the literal type checker | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Myles C. Maxfield <mmaxfield> | ||||||||
Component: | New Bugs | Assignee: | Myles C. Maxfield <mmaxfield> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | dino, fpizlo, jonlee, justin_fan, rmorisset, saam, webkit-bug-importer | ||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||
Version: | WebKit Nightly Build | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Attachments: |
|
Description
Myles C. Maxfield
2019-01-14 20:45:55 PST
Created attachment 359126 [details]
Patch
Comment on attachment 359126 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=359126&action=review > Source/WebCore/Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp:104 > + virtual void visit(AST::FloatLiteralType& floatLiteralType) > + { > + auto* nativeTypeDeclaration = getNativeTypeDeclaration(floatLiteralType); > + if (!nativeTypeDeclaration) { > + setError(); > + return; > + } > + if (!nativeTypeDeclaration->canRepresentInteger()(floatLiteralType.value())) { > + setError(); > + return; > + } > + } > + > + virtual void visit(AST::IntegerLiteralType& integerLiteralType) > + { > + auto* nativeTypeDeclaration = getNativeTypeDeclaration(integerLiteralType); > + if (!nativeTypeDeclaration) { > + setError(); > + return; > + } > + if (!nativeTypeDeclaration->canRepresentInteger()(integerLiteralType.value())) { > + setError(); > + return; > + } > + } > + > + virtual void visit(AST::UnsignedIntegerLiteralType& unsignedIntegerLiteralType) > + { > + auto* nativeTypeDeclaration = getNativeTypeDeclaration(unsignedIntegerLiteralType); > + if (!nativeTypeDeclaration) { > + setError(); > + return; > + } > + if (!nativeTypeDeclaration->canRepresentInteger()(unsignedIntegerLiteralType.value())) { > + setError(); > + return; > + } > + } > + > + virtual void visit(AST::NullLiteralType& nullLiteralType) > + { > + if (!nullLiteralType.resolvedType()) > + setError(); > + } These can be private. Comment on attachment 359126 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=359126&action=review >> Source/WebCore/Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp:104 >> + } > > These can be private. Also be marked as override instead of virtual. Created attachment 359216 [details]
Patch
Created attachment 359245 [details]
Patch
Comment on attachment 359245 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=359245&action=review > Source/WebCore/Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp:67 > + ASSERT(nativeTypeDeclaration->canRepresentInteger()(floatLiteralType.value())); This doesn’t look correct to me but I haven’t looked in detail. Shouldn’t this be something like canRepresentFloat? > Source/WebCore/Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp:100 > +} // namespace .. Comment on attachment 359245 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=359245&action=review > Source/WebCore/Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp:60 > + LiteralTypeChecker() = default; > + > + virtual ~LiteralTypeChecker() = default; Not needed. Committed r240095: <https://trac.webkit.org/changeset/240095> |