}
}
private void FinishTraits(ObjectValue obj, ObjectList<ByteList> traits)
{
Names names = obj.builder.getNames();
if (names != null)
{
if(Builder.removeBuilderNames)
//if(false)
{
// addSlotTraits/addMethodTraits ignore's the value of the Qualifier so a list of
// namespaces would suffice although even better to refactor these methods to take
// one namespace at a time
Qualifiers q = new Qualifiers();
for (int i = 0; (i = names.hasNext(i)) != -1; i++)
{
q.clear();
int slotId = names.getSlot(i);
String name = names.getName(i);
q.put(names.getNamespace(i), 0);
if(slotId < 1)
continue;
Slot s = obj.getSlot(cx, slotId);
if (names.getNamespace(i) == ObjectValue.loopLabelNamespace || s == null)
continue;
if(s.declaredBy != obj)
continue;
if(s instanceof VariableSlot && names.getType(i) != Names.SET_NAMES)
{
addSlotTrait(obj, traits, name, q);
}
if(s instanceof MethodSlot)
{
int methodKind = TRAIT_Method;
if(s.isGetter())
methodKind = TRAIT_Getter;
if(names.getType(i) == Names.SET_NAMES)
methodKind = TRAIT_Setter;
addMethodTrait(methodKind, obj, traits, name, q);
}
}
}
else
{
for( Map.Entry<String, Qualifiers> n : names.entrySet(Names.VAR_NAMES))
{
// Add trait for multiname var
addSlotTrait(obj,traits,n.getKey(), n.getValue());
}
for( Map.Entry<String, Qualifiers> n : names.entrySet(Names.METHOD_NAMES))
{
addMethodTrait(TRAIT_Method,obj,traits,n.getKey(), n.getValue());
}
for( Map.Entry<String, Qualifiers> n : names.entrySet(Names.GET_NAMES))
{
addMethodTrait(TRAIT_Getter,obj,traits,n.getKey(), n.getValue());
}
for( Map.Entry<String, Qualifiers> n : names.entrySet(Names.SET_NAMES))
{
addMethodTrait(TRAIT_Setter,obj,traits,n.getKey(), n.getValue());
}
}
}