return true;
}
-void ProgramCompiler::InterfaceGenerator::insert_assignment(const string &left, ProgramSyntax::Expression *right)
+ExpressionStatement &ProgramCompiler::InterfaceGenerator::insert_assignment(const string &left, ProgramSyntax::Expression *right)
{
Assignment *assign = new Assignment;
VariableReference *ref = new VariableReference;
stmt->expression = assign;
stmt->visit(*this);
insert_nodes.push_back(stmt);
+
+ return *stmt;
}
void ProgramCompiler::InterfaceGenerator::visit(VariableReference &var)
remove_node = true;
if(var.init_expression)
{
- insert_assignment(var.name, var.init_expression->clone());
+ ExpressionStatement &stmt = insert_assignment(var.name, var.init_expression->clone());
+ stmt.source = var.source;
+ stmt.line = var.line;
return;
}
}
virtual void visit(ProgramSyntax::Block &);
std::string change_prefix(const std::string &, const std::string &) const;
bool generate_interface(ProgramSyntax::VariableDeclaration &, const std::string &, const std::string &);
- void insert_assignment(const std::string &, ProgramSyntax::Expression *);
+ ProgramSyntax::ExpressionStatement &insert_assignment(const std::string &, ProgramSyntax::Expression *);
virtual void visit(ProgramSyntax::VariableReference &);
virtual void visit(ProgramSyntax::VariableDeclaration &);
virtual void visit(ProgramSyntax::Passthrough &);