summaryrefslogtreecommitdiffstats
path: root/source/slang/syntax.h
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-06-28 11:39:40 -0700
committerTim Foley <tfoley@nvidia.com>2017-06-28 11:51:23 -0700
commitff53669ed918c87d15ddea2d07fda84d4c8eff5d (patch)
tree0082315629ad76add2ebffe04dcd1f64943c0a9f /source/slang/syntax.h
parentb8e31688c6826475b5199468aedea0bc44c0adc1 (diff)
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.
Diffstat (limited to 'source/slang/syntax.h')
-rw-r--r--source/slang/syntax.h14
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;