diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2017-08-09 10:23:29 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-09 10:23:29 -0700 |
| commit | 8e4c0c35d6c2d0fd754b713441c2eee8f13f87b2 (patch) | |
| tree | 4500ab6d1b6148e883988a9624936cfded61131f /source/slang/syntax-base-defs.h | |
| parent | 9ad2b40b79907c847451891ce2716fcbcdd2e916 (diff) | |
| parent | a728612771cdaed66a0bdbfd25f8f250920f0f11 (diff) | |
Merge pull request #154 from tfoleyNV/fix-lowering
Fix use of "pseudo-syntax" in current lowering pass
Diffstat (limited to 'source/slang/syntax-base-defs.h')
| -rw-r--r-- | source/slang/syntax-base-defs.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/slang/syntax-base-defs.h b/source/slang/syntax-base-defs.h index eda554988..bcb37de09 100644 --- a/source/slang/syntax-base-defs.h +++ b/source/slang/syntax-base-defs.h @@ -10,6 +10,16 @@ ABSTRACT_SYNTAX_CLASS(SyntaxNodeBase, RefObject) // The primary source location associated with this AST node FIELD(CodePosition, Position) + + RAW( + // Allow dynamic casting with a convenient syntax + template<typename T> + T* As() + { + return dynamic_cast<T*>(this); + } + ) + END_SYNTAX_CLASS() // Base class for compile-time values (most often a type). |
