diff options
| author | Yong He <yonghe@outlook.com> | 2025-03-19 11:44:04 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-19 11:44:04 -0700 |
| commit | 4eb7a27ac4532a49b9d383d2b0d80bc0ec317b4c (patch) | |
| tree | 3219e185674c04423e3306437e2a31223fadeb49 /source/slang/slang-parser.cpp | |
| parent | eee974d74617944ca2b6f6ac424e98a12a51b82c (diff) | |
Fix reinterpret and bitcast and generic arg parsing. (#6627)
* Fix reinterpret and bitcast.
* Fix warning.
* Fix.
* Fix.
---------
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
Diffstat (limited to 'source/slang/slang-parser.cpp')
| -rw-r--r-- | source/slang/slang-parser.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp index aec3b4e90..6bf26b014 100644 --- a/source/slang/slang-parser.cpp +++ b/source/slang/slang-parser.cpp @@ -7721,6 +7721,31 @@ static Expr* parsePostfixExpr(Parser* parser) expr = memberExpr; } break; + case TokenType::OpMul: + { + // We may have a pointer type expr, e.g. T*, or the `*` is a mul operator. + // We can easily disambiguate by looking ahead of `*`, if the token after it + // is `,`, `>`, `)` or `>>`, then it must be a type postfix. + auto lookahead = peekTokenType(parser, 1); + switch (lookahead) + { + case TokenType::Comma: + case TokenType::RParent: + case TokenType::OpGreater: + case TokenType::OpRsh: + case TokenType::Colon: + case TokenType::Semicolon: + case TokenType::LBracket: + case TokenType::OpMul: + case TokenType::Dot: + case TokenType::Scope: + expr = parsePostfixTypeSuffix(parser, expr); + break; + default: + return expr; + } + } + break; } } } |
