Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
flags |= 16384 /* TypeDirective */;
deps = providerMeta.deps || providerMeta.useClass.diDeps;
}
else {
if (providerMeta.useClass) {
providerExpr = ctx.importExpr(providerMeta.useClass.reference);
flags |= 512 /* TypeClassProvider */;
deps = providerMeta.deps || providerMeta.useClass.diDeps;
}
else if (providerMeta.useFactory) {
providerExpr = ctx.importExpr(providerMeta.useFactory.reference);
flags |= 1024 /* TypeFactoryProvider */;
deps = providerMeta.deps || providerMeta.useFactory.diDeps;
}
else if (providerMeta.useExisting) {
providerExpr = o.NULL_EXPR;
flags |= 2048 /* TypeUseExistingProvider */;
deps = [{ token: providerMeta.useExisting }];
}
else {
providerExpr = value_util_1.convertValueToOutputAst(ctx, providerMeta.useValue);
flags |= 256 /* TypeValueProvider */;
deps = [];
}
}
var depsExpr = o.literalArr(deps.map(function (dep) { return depDef(ctx, dep); }));
return { providerExpr: providerExpr, flags: flags, depsExpr: depsExpr };
}
function tokenExpr(ctx, tokenMeta) {
function getConstantLiteralFromArray(constantPool, values) {
return values.length ? constantPool.getConstLiteral(o.literalArr(values), true) : o.NULL_EXPR;
}
/**
function selectorsFromGlobalMetadata(selectors, outputCtx) {
if (selectors.length > 1 || (selectors.length == 1 && selectors[0].value)) {
var selectorStrings = selectors.map(function (value) { return value.value; });
selectorStrings.some(function (value) { return !value; }) &&
util_1.error('Found a type among the string selectors expected');
return outputCtx.constantPool.getConstLiteral(o.literalArr(selectorStrings.map(function (value) { return o.literal(value); })));
}
if (selectors.length == 1) {
var first = selectors[0];
if (first.identifier) {
return outputCtx.importExpr(first.identifier.reference);
}
}
util_1.error('Unexpected query form');
return o.NULL_EXPR;
}
/**
function selectorsFromGlobalMetadata(selectors, outputCtx) {
if (selectors.length > 1 || (selectors.length == 1 && selectors[0].value)) {
var selectorStrings = selectors.map(function (value) { return value.value; });
selectorStrings.some(function (value) { return !value; }) &&
util_1.error('Found a type among the string selectors expected');
return outputCtx.constantPool.getConstLiteral(o.literalArr(selectorStrings.map(function (value) { return o.literal(value); })));
}
if (selectors.length == 1) {
var first = selectors[0];
if (first.identifier) {
return outputCtx.importExpr(first.identifier.reference);
}
}
util_1.error('Unexpected query form');
return o.NULL_EXPR;
}
function createQueryDefinition(query, constantPool, idx) {
function makeConditionalFactory(nonCtorExpr) {
var r = o.variable('r');
body.push(r.set(o.NULL_EXPR).toDeclStmt());
body.push(o.ifStmt(t, [r.set(ctorExprFinal).toStmt()], [r.set(nonCtorExpr).toStmt()]));
return r;
}
if (isDelegatedMetadata(meta) && meta.delegateType === R3FactoryDelegateType.Factory) {
ConstantPool.prototype.getDeferredTranslationConst = function (suffix) {
var index = this.statements.push(new o.ExpressionStatement(o.NULL_EXPR)) - 1;
var variable = o.variable(this.freshTranslationName(suffix));
this.deferredTranslations.set(variable, index);
return variable;
};
ConstantPool.prototype.setDeferredTranslationConst = function (variable, message) {
function addParam(params, predicate, value, argNumber, totalExpectedArgs) {
if (predicate && value) {
params.push(value);
}
else if (argNumber < totalExpectedArgs) {
params.push(o.NULL_EXPR);
}
}
function parseProperty(name) {
InjectableCompiler.prototype.injectableDef = function (injectable, ctx) {
var providedIn = o.NULL_EXPR;
if (injectable.providedIn !== undefined) {
if (injectable.providedIn === null) {
providedIn = o.NULL_EXPR;
}
else if (typeof injectable.providedIn === 'string') {
providedIn = o.literal(injectable.providedIn);
}
else {
providedIn = ctx.importExpr(injectable.providedIn);
}
}
var def = [
mapEntry('factory', this.factoryFor(injectable, ctx)),
mapEntry('token', ctx.importExpr(injectable.type.reference)),
mapEntry('providedIn', providedIn),
];
return o.importExpr(identifiers_1.Identifiers.defineInjectable).callFn([o.literalMap(def)]);
};
InjectableCompiler.prototype.compile = function (injectable, ctx) {