diff options
| author | Tim Foley <tfoley@nvidia.com> | 2017-07-08 17:04:31 -0700 |
|---|---|---|
| committer | Tim Foley <tfoley@nvidia.com> | 2017-07-08 18:22:26 -0700 |
| commit | 6233f9b35f1901ca33c53ce37f9b1517e91e1d79 (patch) | |
| tree | ba7171bfe69a81a8425795e77f75a093a7a95e90 /source/slang/expr-defs.h | |
| parent | c77c0390d8da6c1769e0a9c5b2f862b3598d9b8f (diff) | |
Revise how hidden implicit casts are recognized.
The old approach used an `isRewriter` flag in the emit logic, but I kind of need that flag to go away.
Instead, I now how the semantic checking pass detect whether an implicitly-generated type cast is in rewriter code, and if so it uses the new `HiddenImplicitCastExpr` AST node.
The emit logic then looks for that specific node and eliminates it.
Diffstat (limited to 'source/slang/expr-defs.h')
| -rw-r--r-- | source/slang/expr-defs.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/slang/expr-defs.h b/source/slang/expr-defs.h index 5ca6629b9..0dac324b9 100644 --- a/source/slang/expr-defs.h +++ b/source/slang/expr-defs.h @@ -91,14 +91,25 @@ SYNTAX_CLASS(DerefExpr, ExpressionSyntaxNode) SYNTAX_FIELD(RefPtr<ExpressionSyntaxNode>, base) END_SYNTAX_CLASS() +// Any operation that performs type-casting SYNTAX_CLASS(TypeCastExpressionSyntaxNode, ExpressionSyntaxNode) SYNTAX_FIELD(TypeExp, TargetType) SYNTAX_FIELD(RefPtr<ExpressionSyntaxNode>, Expression) END_SYNTAX_CLASS() +// An explicit type-cast that appear in the user's code with `(Type) expr` syntax +SYNTAX_CLASS(ExplicitCastExpr, TypeCastExpressionSyntaxNode) +END_SYNTAX_CLASS() + +// An implicit type-cast inserted during semantic checking SYNTAX_CLASS(ImplicitCastExpr, TypeCastExpressionSyntaxNode) END_SYNTAX_CLASS() +// An implicit type-cast that should also be hidden on output, +// because we don't want to mess with the user's code +SYNTAX_CLASS(HiddenImplicitCastExpr, ImplicitCastExpr) +END_SYNTAX_CLASS() + SIMPLE_SYNTAX_CLASS(SelectExpressionSyntaxNode, OperatorExpressionSyntaxNode) SIMPLE_SYNTAX_CLASS(GenericAppExpr, AppExprBase) |
