Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
bindCustomAttribute(attrSyntax, attrInfo) {
if (Tracer.enabled) {
Tracer.enter('TemplateBinder', 'bindCustomAttribute', slice.call(arguments));
}
const command = this.resources.getBindingCommand(attrSyntax);
let symbol;
if (command == null && attrInfo.hasDynamicOptions) {
// a dynamicOptions (semicolon separated binding) is only valid without a binding command;
// the binding commands must be declared in the dynamicOptions expression itself
symbol = new CustomAttributeSymbol(attrSyntax, attrInfo);
this.bindMultiAttribute(symbol, attrInfo, attrSyntax.rawValue);
}
else {
// we've either got a command (with or without dynamicOptions, the latter maps to the first bindable),
// or a null command but without dynamicOptions (which may be an interpolation or a normal string)
symbol = new CustomAttributeSymbol(attrSyntax, attrInfo);
const bindingType = command == null ? 2048 /* Interpolation */ : command.bindingType;
const expr = this.exprParser.parse(attrSyntax.rawValue, bindingType);
symbol.bindings.push(new BindingSymbol(command, attrInfo.bindable, expr, attrSyntax.rawValue, attrSyntax.target));
}
this.manifest.attributes.push(symbol);
this.manifest.isTarget = true;
if (Tracer.enabled) {
Tracer.leave();
}
}
private bindCustomAttribute(attrSyntax: AttrSyntax, attrInfo: AttrInfo): void {
const command = this.resources.getBindingCommand(attrSyntax, false);
let symbol: CustomAttributeSymbol;
if (command == null && attrInfo.hasDynamicOptions) {
// a dynamicOptions (semicolon separated binding) is only valid without a binding command;
// the binding commands must be declared in the dynamicOptions expression itself
symbol = new CustomAttributeSymbol(attrSyntax, attrInfo);
this.bindMultiAttribute(symbol, attrInfo, attrSyntax.rawValue);
} else {
// we've either got a command (with or without dynamicOptions, the latter maps to the first bindable),
// or a null command but without dynamicOptions (which may be an interpolation or a normal string)
symbol = new CustomAttributeSymbol(attrSyntax, attrInfo);
const bindingType = command == null ? BindingType.Interpolation : command.bindingType;
const expr = this.exprParser.parse(attrSyntax.rawValue, bindingType);
symbol.bindings.push(new BindingSymbol(command, attrInfo.bindable, expr, attrSyntax.rawValue, attrSyntax.target));
}
const manifest = this.manifest!;
manifest.customAttributes.push(symbol);
manifest.isTarget = true;
}
bindCustomAttribute(attrSyntax, attrInfo) {
if (Tracer.enabled) {
Tracer.enter('TemplateBinder', 'bindCustomAttribute', slice.call(arguments));
}
const command = this.resources.getBindingCommand(attrSyntax);
let symbol;
if (command == null && attrInfo.hasDynamicOptions) {
// a dynamicOptions (semicolon separated binding) is only valid without a binding command;
// the binding commands must be declared in the dynamicOptions expression itself
symbol = new CustomAttributeSymbol(attrSyntax, attrInfo);
this.bindMultiAttribute(symbol, attrInfo, attrSyntax.rawValue);
}
else {
// we've either got a command (with or without dynamicOptions, the latter maps to the first bindable),
// or a null command but without dynamicOptions (which may be an interpolation or a normal string)
symbol = new CustomAttributeSymbol(attrSyntax, attrInfo);
const bindingType = command == null ? 2048 /* Interpolation */ : command.bindingType;
const expr = this.exprParser.parse(attrSyntax.rawValue, bindingType);
symbol.bindings.push(new BindingSymbol(command, attrInfo.bindable, expr, attrSyntax.rawValue, attrSyntax.target));
}
this.manifest.attributes.push(symbol);
this.manifest.isTarget = true;
if (Tracer.enabled) {
Tracer.leave();
}
}
bindMultiAttribute(symbol, attrInfo, value) {
private bindCustomAttribute(attrSyntax: AttrSyntax, attrInfo: AttrInfo): void {
const command = this.resources.getBindingCommand(attrSyntax, false);
let symbol: CustomAttributeSymbol;
if (command == null && attrInfo.hasDynamicOptions) {
// a dynamicOptions (semicolon separated binding) is only valid without a binding command;
// the binding commands must be declared in the dynamicOptions expression itself
symbol = new CustomAttributeSymbol(attrSyntax, attrInfo);
this.bindMultiAttribute(symbol, attrInfo, attrSyntax.rawValue);
} else {
// we've either got a command (with or without dynamicOptions, the latter maps to the first bindable),
// or a null command but without dynamicOptions (which may be an interpolation or a normal string)
symbol = new CustomAttributeSymbol(attrSyntax, attrInfo);
const bindingType = command == null ? BindingType.Interpolation : command.bindingType;
const expr = this.exprParser.parse(attrSyntax.rawValue, bindingType);
symbol.bindings.push(new BindingSymbol(command, attrInfo.bindable, expr, attrSyntax.rawValue, attrSyntax.target));
}
const manifest = this.manifest!;
manifest.customAttributes.push(symbol);
manifest.isTarget = true;
}