Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} else if (field.isGroup()) {
jsType = getFullClassName(lookupNode(ctx, field.getGroup().getTypeId()));
whichType = "group";
} else {
throw new Error(format(E.GEN_UNKNOWN_STRUCT_FIELD, field.which()));
}
const jsTypeReference = ts.createTypeReferenceNode(jsType, __);
const discriminantOffset = node.getStruct().getDiscriminantOffset();
const name = field.getName();
const properName = util.c2t(name);
const hadExplicitDefault =
field.isSlot() && field.getSlot().getHadExplicitDefault();
const discriminantValue = field.getDiscriminantValue();
const fullClassName = getFullClassName(node);
const union = discriminantValue !== s.Field.NO_DISCRIMINANT;
const offset = (field.isSlot() && field.getSlot().getOffset()) || 0;
const offsetLiteral = ts.createNumericLiteral(offset.toString());
/** __S.getPointer(0, this) */
const getPointer = ts.createCall(
ts.createPropertyAccess(STRUCT, "getPointer"),
__,
[offsetLiteral, THIS]
);
/** __S.copyFrom(value, __S.getPointer(0, this)) */
const copyFromValue = ts.createCall(
ts.createPropertyAccess(STRUCT, "copyFrom"),
__,
[VALUE, getPointer]
);
/** capnp.Orphan */
const orphanType = ts.createTypeReferenceNode("capnp.Orphan", [
.filter(f => f.getDiscriminantValue() !== s.Field.NO_DISCRIMINANT);
}