Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
case s.Type_Which.BOOL:
initializer = ts.createCall(ts.createPropertyAccess(CAPNP, p.mask), __, [
createValueExpression(slot.getDefaultValue()),
ts.createNumericLiteral((slot.getOffset() % 8).toString())
]);
break;
case s.Type_Which.ENUM:
case s.Type_Which.FLOAT32:
case s.Type_Which.FLOAT64:
case s.Type_Which.INT16:
case s.Type_Which.INT32:
case s.Type_Which.INT64:
case s.Type_Which.INT8:
case s.Type_Which.UINT16:
case s.Type_Which.UINT32:
case s.Type_Which.UINT64:
case s.Type_Which.UINT8:
initializer = ts.createCall(ts.createPropertyAccess(CAPNP, p.mask), __, [
createValueExpression(slot.getDefaultValue())
]);
break;
default:
throw new Error(
format(E.GEN_UNKNOWN_DEFAULT, s.Type_Which[whichSlotType])
);
}
return ts.createPropertyAssignment(`default${util.c2t(name)}`, initializer);