Title: [245727] trunk/Source/WebCore
Revision
245727
Author
[email protected]
Date
2019-05-23 16:41:56 -0700 (Thu, 23 May 2019)

Log Message

[WHLSL] Make the AST dumper disambiguate expressions using parenthesis to represent AST construction
https://bugs.webkit.org/show_bug.cgi?id=198199

Reviewed by Myles C. Maxfield.

We would dump "*foo.bar" for "(*foo).bar", which is super confusing.
We now dump "(*foo).bar".

* Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
(WebCore::WHLSL::ASTDumper::visit):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (245726 => 245727)


--- trunk/Source/WebCore/ChangeLog	2019-05-23 23:36:36 UTC (rev 245726)
+++ trunk/Source/WebCore/ChangeLog	2019-05-23 23:41:56 UTC (rev 245727)
@@ -1,5 +1,18 @@
 2019-05-23  Saam barati  <[email protected]>
 
+        [WHLSL] Make the AST dumper disambiguate expressions using parenthesis to represent AST construction
+        https://bugs.webkit.org/show_bug.cgi?id=198199
+
+        Reviewed by Myles C. Maxfield.
+
+        We would dump "*foo.bar" for "(*foo).bar", which is super confusing.
+        We now dump "(*foo).bar".
+
+        * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
+        (WebCore::WHLSL::ASTDumper::visit):
+
+2019-05-23  Saam barati  <[email protected]>
+
         [WHLSL] Don't wrap anonymous variables in parens in the AST dumper
         https://bugs.webkit.org/show_bug.cgi?id=198196
 

Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLASTDumper.cpp (245726 => 245727)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLASTDumper.cpp	2019-05-23 23:36:36 UTC (rev 245726)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLASTDumper.cpp	2019-05-23 23:41:56 UTC (rev 245727)
@@ -419,7 +419,20 @@
 
 void ASTDumper::visit(AST::_expression_& _expression_)
 {
+    bool skipParens = is<AST::BooleanLiteral>(_expression_)
+        || is<AST::FloatLiteral>(_expression_)
+        || is<AST::IntegerLiteral>(_expression_)
+        || is<AST::NullLiteral>(_expression_)
+        || is<AST::UnsignedIntegerLiteral>(_expression_)
+        || is<AST::EnumerationMemberLiteral>(_expression_)
+        || is<AST::CommaExpression>(_expression_)
+        || is<AST::VariableReference>(_expression_);
+
+    if (!skipParens)
+        m_out.print("(");
     Base::visit(_expression_);
+    if (!skipParens)
+        m_out.print(")");
 }
 
 void ASTDumper::visit(AST::DotExpression& dotExpression)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to