TraversingVisitor::visit(memacc);
VariableDeclaration *declaration = 0;
+ int index = -1;
if(StructDeclaration *strct = dynamic_cast<StructDeclaration *>(memacc.left->type))
{
map<string, VariableDeclaration *>::iterator i = strct->members.variables.find(memacc.member);
if(i!=strct->members.variables.end())
{
declaration = i->second;
+ for(NodeList<Statement>::const_iterator j=strct->members.body.begin(); (j!=strct->members.body.end() && j->get()!=i->second); ++j)
+ ++index;
if(record_target)
- {
- unsigned index = 0;
- for(NodeList<Statement>::const_iterator j=strct->members.body.begin(); (j!=strct->members.body.end() && j->get()!=i->second); ++j)
- ++index;
-
add_to_chain(Assignment::Target::MEMBER, index);
- }
}
}
else if(BasicTypeDeclaration *basic = dynamic_cast<BasicTypeDeclaration *>(memacc.left->type))
}
}
- r_any_resolved |= (declaration!=memacc.declaration);
+ r_any_resolved |= (declaration!=memacc.declaration || index!=memacc.index);
memacc.declaration = declaration;
+ memacc.index = index;
}
void VariableResolver::visit(Swizzle &swizzle)
MemberAccess::MemberAccess():
- declaration(0)
+ declaration(0),
+ index(-1)
{ }
MemberAccess::MemberAccess(const MemberAccess &other):
Expression(other),
left(other.left),
member(other.member),
- declaration(0)
+ declaration(0),
+ index(-1)
{ }
void MemberAccess::visit(NodeVisitor &visitor)