summaryrefslogtreecommitdiffstats
path: root/source/slang/emit.cpp
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/emit.cpp
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/emit.cpp')
-rw-r--r--source/slang/emit.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp
index 9a1d44641..dc7c68aa4 100644
--- a/source/slang/emit.cpp
+++ b/source/slang/emit.cpp
@@ -197,6 +197,14 @@ static void emitName(EmitContext* context, String const& name)
emitName(context, name, CodePosition());
}
+static void Emit(EmitContext* context, IntegerLiteralValue value)
+{
+ char buffer[32];
+ sprintf(buffer, "%lld", value);
+ Emit(context, buffer);
+}
+
+
static void Emit(EmitContext* context, UInt value)
{
char buffer[32];
@@ -923,7 +931,7 @@ static void EmitExprWithPrecedence(EmitContext* context, RefPtr<ExpressionSyntax
{
assert(!"unimplemented");
}
- Emit(context, litExpr->IntValue);
+ Emit(context, litExpr->integerValue);
Emit(context, suffix);
break;
@@ -945,12 +953,12 @@ static void EmitExprWithPrecedence(EmitContext* context, RefPtr<ExpressionSyntax
{
assert(!"unimplemented");
}
- Emit(context, litExpr->FloatValue);
+ Emit(context, litExpr->floatingPointValue);
Emit(context, suffix);
break;
case ConstantExpressionSyntaxNode::ConstantType::Bool:
- Emit(context, litExpr->IntValue ? "true" : "false");
+ Emit(context, litExpr->integerValue ? "true" : "false");
break;
case ConstantExpressionSyntaxNode::ConstantType::String:
emitStringLiteral(context, litExpr->stringValue);