summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/AST/PostfixExpression.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Sencha-lang/AST/PostfixExpression.cpp')
-rw-r--r--Sencha-lang/AST/PostfixExpression.cpp29
1 files changed, 3 insertions, 26 deletions
diff --git a/Sencha-lang/AST/PostfixExpression.cpp b/Sencha-lang/AST/PostfixExpression.cpp
index 5fac1dc..7e3c658 100644
--- a/Sencha-lang/AST/PostfixExpression.cpp
+++ b/Sencha-lang/AST/PostfixExpression.cpp
@@ -37,31 +37,7 @@ void PostfixExpression::add_argument(ASTExpression * expression)
SenchaObject PostfixExpression::evaluate()
{
- SenchaObject result = SenchaObject();
- if(operation == "call")
- return context_manager->execute_function(name, arguments);
- else if(operation == "access")
- {
- SenchaObject called_value = context_manager->get_top()->get(name);
- SenchaObject access_index = access_index_expr->execute();
- //std::cout << "index is: " << access_index.repr() << std::endl;
- if(access_index.type == SenchaObject::integer_number)
- {
- if(called_value.type == SenchaObject::string_literal)
- {
- SenchaArray array(name, context_manager->get_top(), called_value.text);
- return array.get(access_index.integer);
- }
- else
- {
- SenchaArray array(name, context_manager->get_top());
- return array.get(access_index.integer);
- }
- }
-
- }
- result.type = SenchaObject::invalid;
- return result;
+ return execute();
}
SenchaObject PostfixExpression::execute() {
@@ -76,7 +52,8 @@ SenchaObject PostfixExpression::execute() {
{
if(called_value.type == SenchaObject::string_literal)
{
- SenchaArray array(name, context_manager->get_top(), called_value.text);
+ called_value = context_manager->get_top()->get_updated_string(name);
+ SenchaArray array(name, context_manager, called_value.text);
return array.get(access_index.integer);
}
}