- memacc.declaration = i->second;
- if(StructDeclaration *strct = dynamic_cast<StructDeclaration *>(i->second->type_declaration))
- r_members = &strct->members.variables;
+ static const char component_names[] = { 'x', 'r', 's', 'y', 'g', 't', 'z', 'b', 'p', 'w', 'a', 'q' };
+
+ bool ok = true;
+ UInt8 components[4] = { };
+ for(unsigned i=0; (ok && i<memacc.member.size()); ++i)
+ ok = ((components[i] = (find(component_names, component_names+12, memacc.member[i])-component_names)/3) < 4);
+
+ if(ok)
+ {
+ Swizzle *swizzle = new Swizzle;
+ swizzle->source = memacc.source;
+ swizzle->line = memacc.line;
+ swizzle->oper = memacc.oper;
+ swizzle->left = memacc.left;
+ swizzle->component_group = memacc.member;
+ swizzle->count = memacc.member.size();
+ copy(components, components+memacc.member.size(), swizzle->components);
+ r_replacement_expr = swizzle;
+ }