From ff53669ed918c87d15ddea2d07fda84d4c8eff5d Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Wed, 28 Jun 2017 11:39:40 -0700 Subject: Store integer literals at high precision in AST The lexer was creating an `unsigned long long` value, and then the AST was storing it in an `int`. This change makes both use a `long long`. This is obviously still a stopgap until I can get arbitrary precisions in here. --- source/slang/syntax.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'source/slang/syntax.h') 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 val); + IntegerLiteralValue GetIntVal(RefPtr 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(); 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 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 Accept(SyntaxVisitor * visitor) override; -- cgit v1.2.3