diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2017-06-28 12:17:47 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-28 12:17:47 -0700 |
| commit | 16613ed981fc5dc38966f5108e85b1aee36ef92f (patch) | |
| tree | 0082315629ad76add2ebffe04dcd1f64943c0a9f /source/slang/syntax.h | |
| parent | b8e31688c6826475b5199468aedea0bc44c0adc1 (diff) | |
| parent | ff53669ed918c87d15ddea2d07fda84d4c8eff5d (diff) | |
Merge pull request #50 from tfoleyNV/literal-fix-fix
Store integer literals at high precision in AST
Diffstat (limited to 'source/slang/syntax.h')
| -rw-r--r-- | source/slang/syntax.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/source/slang/syntax.h b/source/slang/syntax.h index 81d6f8e01..05d3b6a79 100644 --- a/source/slang/syntax.h +++ b/source/slang/syntax.h @@ -437,15 +437,15 @@ namespace Slang // Try to extract a simple integer value from an `IntVal`. // This fill assert-fail if the object doesn't represent a literal value. - int GetIntVal(RefPtr<IntVal> val); + IntegerLiteralValue GetIntVal(RefPtr<IntVal> val); // Trivial case of a value that is just a constant integer class ConstantIntVal : public IntVal { public: - int value; + IntegerLiteralValue value; - ConstantIntVal(int value) + ConstantIntVal(IntegerLiteralValue value) : value(value) {} @@ -1188,7 +1188,7 @@ namespace Slang { auto constantVal = vecType->elementCount.As<ConstantIntVal>(); if (constantVal) - return constantVal->value; + return (int) constantVal->value; // TODO: what to do in this case? return 0; } @@ -1913,8 +1913,6 @@ namespace Slang virtual RefPtr<SyntaxNode> Accept(SyntaxVisitor * visitor) override; }; - typedef double FloatingPointLiteralValue; - class ConstantExpressionSyntaxNode : public ExpressionSyntaxNode { public: @@ -1930,8 +1928,8 @@ namespace Slang ConstantType ConstType; union { - int IntValue; - FloatingPointLiteralValue FloatValue; + IntegerLiteralValue integerValue; + FloatingPointLiteralValue floatingPointValue; }; String stringValue; virtual RefPtr<SyntaxNode> Accept(SyntaxVisitor * visitor) override; |
