Implements assignment binding
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include <utility>
|
||||
|
||||
|
||||
|
||||
#ifndef PORYGONLANG_PARSEDSTATEMENT_HPP
|
||||
@@ -8,6 +12,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "../ParsedExpressions/ParsedExpression.hpp"
|
||||
#include "../../Utilities/HashedString.hpp"
|
||||
|
||||
enum class ParsedStatementKind{
|
||||
Bad,
|
||||
@@ -32,6 +37,10 @@ public:
|
||||
return _start;
|
||||
}
|
||||
|
||||
unsigned int GetLength(){
|
||||
return _length;
|
||||
}
|
||||
|
||||
unsigned int GetEndPosition(){
|
||||
return _start + _length - 1;
|
||||
}
|
||||
@@ -98,13 +107,13 @@ public:
|
||||
|
||||
class ParsedAssignmentStatement : public ParsedStatement{
|
||||
bool _local;
|
||||
std::string _identifier;
|
||||
HashedString _identifier;
|
||||
ParsedExpression* _expression;
|
||||
public:
|
||||
ParsedAssignmentStatement(bool local, std::string identifier, ParsedExpression* expression, unsigned int start, unsigned int length)
|
||||
: ParsedStatement(start, length){
|
||||
: ParsedStatement(start, length), _identifier(HashedString(std::move(identifier)))
|
||||
{
|
||||
_local = local;
|
||||
_identifier = std::move(identifier);
|
||||
_expression = expression;
|
||||
}
|
||||
~ParsedAssignmentStatement() final{
|
||||
@@ -119,7 +128,7 @@ public:
|
||||
return _local;
|
||||
}
|
||||
|
||||
std::string GetIdentifier(){
|
||||
HashedString GetIdentifier(){
|
||||
return _identifier;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user