Mark evalValues as const
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-06-17 17:43:54 +02:00
parent d91caa7f32
commit 21d3329c55
14 changed files with 204 additions and 215 deletions

View File

@@ -490,7 +490,7 @@ BoundExpression* Binder::BindPeriodIndexExpression(const PeriodIndexExpression*
BoundExpression* Binder::BindNumericalTableExpression(const ParsedNumericalTableExpression* expression){
auto expressions = expression->GetExpressions();
auto boundExpressions = vector<BoundExpression*>(expressions-> size());
auto boundExpressions = vector<const BoundExpression*>(expressions-> size());
shared_ptr<ScriptType> valueType = nullptr;
if (!boundExpressions.empty()){
boundExpressions[0] = this -> BindExpression(expressions -> at(0));

View File

@@ -1,4 +1,3 @@
#ifndef PORYGONLANG_BOUNDEXPRESSION_HPP
#define PORYGONLANG_BOUNDEXPRESSION_HPP
@@ -107,7 +106,7 @@ public:
class BoundLiteralStringExpression : public BoundExpression{
const u16string _value;
public:
BoundLiteralStringExpression(u16string value, unsigned int start, unsigned int length)
BoundLiteralStringExpression(const u16string& value, unsigned int start, unsigned int length)
: BoundExpression(start, length, make_shared<StringScriptType>(true, HashedString::ConstHash(value.c_str()))),
_value(value)
{
@@ -203,7 +202,7 @@ class BoundUnaryExpression : public BoundExpression {
const BoundUnaryOperation _operation;
public:
BoundUnaryExpression(BoundExpression* operand, BoundUnaryOperation op, shared_ptr<ScriptType> result, unsigned int start, unsigned int length)
: BoundExpression(start, length, result),
: BoundExpression(start, length, std::move(result)),
_operand(operand),
_operation(op)
{
@@ -232,7 +231,7 @@ class BoundFunctionCallExpression : public BoundExpression {
public:
BoundFunctionCallExpression(BoundExpression *functionExpression, vector<BoundExpression *> parameters, shared_ptr<ScriptType> result,
unsigned int start, unsigned int length)
: BoundExpression(start, length, result), _functionExpression(functionExpression), _parameters(std::move(parameters)) {}
: BoundExpression(start, length, std::move(result)), _functionExpression(functionExpression), _parameters(std::move(parameters)) {}
~BoundFunctionCallExpression() final{
delete _functionExpression;
@@ -255,8 +254,8 @@ public:
};
class BoundIndexExpression : public BoundExpression {
BoundExpression* _indexableExpression;
BoundExpression* _indexExpression;
const BoundExpression* _indexableExpression;
const BoundExpression* _indexExpression;
public:
BoundIndexExpression(BoundExpression* indexableExpression, BoundExpression* indexExpression, shared_ptr<ScriptType> result,
unsigned int start, unsigned int length)
@@ -271,18 +270,18 @@ public:
return BoundExpressionKind ::Index;
}
BoundExpression* GetIndexableExpression() const{
const BoundExpression* GetIndexableExpression() const{
return _indexableExpression;
}
BoundExpression* GetIndexExpression() const{
const BoundExpression* GetIndexExpression() const{
return _indexExpression;
}
};
class BoundPeriodIndexExpression : public BoundExpression {
BoundExpression* _indexableExpression;
HashedString _index;
const BoundExpression* _indexableExpression;
const HashedString _index;
public:
BoundPeriodIndexExpression(BoundExpression* indexableExpression, HashedString index, shared_ptr<ScriptType> result,
unsigned int start, unsigned int length)
@@ -306,9 +305,9 @@ public:
};
class BoundNumericalTableExpression : public BoundExpression{
const vector<BoundExpression*> _expressions;
const vector<const BoundExpression*> _expressions;
public:
BoundNumericalTableExpression(vector<BoundExpression*> expressions, shared_ptr<ScriptType> type, unsigned int start, unsigned int length)
BoundNumericalTableExpression(vector<const BoundExpression*> expressions, shared_ptr<ScriptType> type, unsigned int start, unsigned int length)
: BoundExpression(start, length, std::move(type)),
_expressions(std::move(expressions))
{}
@@ -323,7 +322,7 @@ public:
return BoundExpressionKind ::NumericalTable;
}
const vector<BoundExpression*>* GetExpressions() const{
const vector<const BoundExpression*>* GetExpressions() const{
return &_expressions;
}
};

View File

@@ -7,7 +7,7 @@
#include "../BoundStatements/BoundStatement.hpp"
class BoundTableExpression : public BoundExpression{
BoundBlockStatement* _block;
const BoundBlockStatement* _block;
public:
BoundTableExpression(BoundBlockStatement* block, shared_ptr<ScriptType> type, unsigned int start, unsigned int length)
: BoundExpression(start, length, std::move(type)){
@@ -22,7 +22,7 @@ public:
return BoundExpressionKind ::Table;
}
BoundBlockStatement* GetBlock(){
const BoundBlockStatement* GetBlock() const {
return _block;
}
};