Website Summary Files Commits Branches @commit @diff @stats
path: root / JSImpl / src / Expression.cpp
blob: b8044e1c28bccf0051519a900178f226f984441d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "Expression.h"
#include <assert.h>

LiteralExpression::LiteralExpression(double v)
	:m_Type(LiteralType::Number)
	, m_NumValue(v)
{}

LiteralExpression::LiteralExpression(IPLString& v)
	: m_Type(LiteralType::String)
	, m_StringValue(v)
{}

LiteralExpression::LiteralExpression(bool v)
	: m_Type(LiteralType::Boolean)
	, m_BooleanValue(v)
{}

LiteralExpression::LiteralExpression(TokenType type)
{
	if (type == TokenType::Null)
	{
		m_Type = LiteralType::Null;
	}
	else if (type == TokenType::Undefined)
	{
		m_Type = LiteralType::Undefined;
	}
	else
	{
		assert(false);
	}
}