Bug 198445 - [WHLSL] Variant + placement new => have a bad time
Summary: [WHLSL] Variant + placement new => have a bad time
Status: RESOLVED DUPLICATE of bug 199726
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGPU (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords:
Depends on: 199726
Blocks:
  Show dependency treegraph
 
Reported: 2019-05-31 17:34 PDT by Saam Barati
Modified: 2019-07-16 14:00 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2019-05-31 17:34:58 PDT
Think about for loop, it has Variant<VariableDeclarationsStatement, Expression>

However, we have passes that replace VariableDeclarationsStatement with Statement. So that breaks the type safety of ForLoop. It seems like the only sensible thing is either forbid replacing certain AST nodes, or only use the more general Expression/Statement.
Comment 1 Robin Morisset 2019-07-10 18:50:45 PDT
Actually there is another option here: just follow the spec that says that
for (X ; e1 ; e2) s
is actually syntactic sugar for
{
    X;
    for(; e1 ; e2) s
}
This should be very easy to do in the parser, would simplify all code that touches for loops (since there is no more initializer to deal with), and the parser can either put the VariableDeclarationsStatement directly into the block, or if it is an expression wrap it in EffectfulExpressionStatement.
Comment 2 Robin Morisset 2019-07-16 14:00:39 PDT
Was fixed in 199726.

*** This bug has been marked as a duplicate of bug 199726 ***