Bug 193430

Summary: [WHLSL] Add the literal type checker
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: New BugsAssignee: 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 Flags
Patch
none
Patch
none
Patch dino: review+

Myles C. Maxfield
Reported 2019-01-14 20:45:55 PST
[WHLSL] Add the literal type checker
Attachments
Patch (12.67 KB, patch)
2019-01-14 20:47 PST, Myles C. Maxfield
no flags
Patch (13.21 KB, patch)
2019-01-15 16:03 PST, Myles C. Maxfield
no flags
Patch (19.83 KB, patch)
2019-01-15 19:10 PST, Myles C. Maxfield
dino: review+
Myles C. Maxfield
Comment 1 2019-01-14 20:47:29 PST
Myles C. Maxfield
Comment 2 2019-01-14 20:53:14 PST
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.
Myles C. Maxfield
Comment 3 2019-01-14 20:55:08 PST
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.
Myles C. Maxfield
Comment 4 2019-01-15 16:03:35 PST
Myles C. Maxfield
Comment 5 2019-01-15 19:10:08 PST
Saam Barati
Comment 6 2019-01-16 08:36:51 PST
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 ..
Dean Jackson
Comment 7 2019-01-16 12:30:10 PST
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.
Myles C. Maxfield
Comment 8 2019-01-16 16:31:27 PST
Radar WebKit Bug Importer
Comment 9 2019-01-16 16:32:38 PST
Note You need to log in before you can comment on or make changes to this bug.