- type = 0;
- binary.left->visit(*this);
- }
- else
- {
- TraversingVisitor::visit(binary);
- type = 0;
- }
-}
-
-void VariableResolver::visit(Assignment &assign)
-{
- {
- SetFlag set(record_target);
- assignment_target = 0;
- assign.left->visit(*this);
- }
-
- self_referencing = false;
- assign.right->visit(*this);
-
- assign.self_referencing = (self_referencing || assign.oper!="=");
- assign.target_declaration = assignment_target;
-}
-
-void VariableResolver::visit(StructDeclaration &strct)
-{
- TraversingVisitor::visit(strct);
- current_block->types[strct.name] = &strct;
-}
-
-void VariableResolver::visit(VariableDeclaration &var)
-{
- for(Block *block=current_block; block; block=next_block(*block))
- {
- map<string, StructDeclaration *>::iterator j = block->types.find(var.type);
- if(j!=block->types.end())
- var.type_declaration = j->second;
- }
-
- if(!block_interface.empty() && var.interface.empty())
- var.interface = block_interface;
-
- TraversingVisitor::visit(var);
- current_block->variables[var.name] = &var;
- if(current_block->anonymous && current_block->parent)
- current_block->parent->variables[var.name] = &var;
-}
-
-void VariableResolver::visit(InterfaceBlock &iface)
-{
- SetForScope<string> set_iface(block_interface, iface.interface);
- TraversingVisitor::visit(iface);
-}
-
-void VariableResolver::visit(FunctionDeclaration &func)
-{
- SetForScope<Block *> set_block(current_block, &func.body);
- func.body.variables.clear();
- TraversingVisitor::visit(func);
-}
-
-void VariableResolver::visit(Iteration &iter)
-{
- SetForScope<Block *> set_block(current_block, &iter.body);
- iter.body.variables.clear();
- TraversingVisitor::visit(iter);
-}
-
-
-void FunctionResolver::visit(FunctionCall &call)
-{
- map<string, vector<FunctionDeclaration *> >::iterator i = functions.find(call.name);
- if(i!=functions.end())
- call.declaration = i->second.back();
-
- TraversingVisitor::visit(call);
-}
-
-void FunctionResolver::visit(FunctionDeclaration &func)
-{
- vector<FunctionDeclaration *> &decls = functions[func.name];
- if(func.definition)
- {
- for(vector<FunctionDeclaration *>::iterator i=decls.begin(); i!=decls.end(); ++i)
- (*i)->definition = func.definition;
- decls.clear();
- decls.push_back(&func);