private IdlType createStruct(CorbaTypeImpl ctype, IdlScopeBase scope,
String local) throws Exception {
Struct s = (Struct)ctype;
boolean undefinedCircular = false;
IdlStruct struct = IdlStruct.create(scope, local);
scope.holdForScope(struct);
Iterator it = s.getMember().iterator();
while (it.hasNext()) {
MemberType m = (MemberType)it.next();
QName qname = m.getIdltype();
IdlType type = findType(qname);
// Ensure that this struct will not be written until
// all of its circular members are defined, unless
// the undefined circular members are of sequence type.
if (!undefinedCircular && !(type instanceof IdlSequence)) {
String mlocal = qname.getLocalPart();
String mname[] = unscopeName(mlocal);
undefinedCircular = null != root.lookup(mname, true);
}
struct.addToScope(IdlField.create(struct, m.getName(), type));
}
if (undefinedCircular) {
scope.parkHeld();
} else {
scope.promoteHeldToScope();
if (struct.isCircular()) {
// resolving this struct closed a recursion
scope.flush();
}
}