summaryrefslogtreecommitdiff
path: root/source/slang/expr-defs.h
diff options
context:
space:
mode:
authorTim Foley <tim.foley.is@gmail.com>2017-07-08 18:58:42 -0700
committerGitHub <noreply@github.com>2017-07-08 18:58:42 -0700
commit68df74b58a56b0a1fb19b9ec4ff0282969cd6a12 (patch)
tree5eaa7eaab892504db53cca4b8044b0c8bcde58b3 /source/slang/expr-defs.h
parentc07a6e6b5f5e0e4839b435ff6c15b821b6dead11 (diff)
parent767d47a842700653b8deffe82ccb3c85ad582c13 (diff)
Merge pull request #60 from tfoleyNV/revise-rewriter
Revise rewriter
Diffstat (limited to 'source/slang/expr-defs.h')
-rw-r--r--source/slang/expr-defs.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/slang/expr-defs.h b/source/slang/expr-defs.h
index ca5bfacb8..0dac324b9 100644
--- a/source/slang/expr-defs.h
+++ b/source/slang/expr-defs.h
@@ -91,11 +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)
@@ -112,3 +126,10 @@ SYNTAX_CLASS(AssignExpr, ExpressionSyntaxNode)
SYNTAX_FIELD(RefPtr<ExpressionSyntaxNode>, right);
END_SYNTAX_CLASS()
+// Just an expression inside parentheses `(exp)`
+//
+// We keep this around explicitly to be sure we don't lose any structure
+// when we do rewriter stuff.
+SYNTAX_CLASS(ParenExpr, ExpressionSyntaxNode)
+ SYNTAX_FIELD(RefPtr<ExpressionSyntaxNode>, base);
+END_SYNTAX_CLASS()