refactor(pipes): removed pipes from properties

BREAKING CHANGE:

This PR remove an ability to use pipes in the properties config. Instead, inject the pipe registry.
This commit is contained in:
vsavkin
2015-06-18 15:40:12 -07:00
parent ad7aca631d
commit 20a8f0dbe5
31 changed files with 261 additions and 270 deletions

View File

@ -141,11 +141,8 @@ export class KeyedAccess extends AST {
visit(visitor: AstVisitor) { return visitor.visitKeyedAccess(this); }
}
export class Pipe extends AST {
constructor(public exp: AST, public name: string, public args: List<any>,
public inBinding: boolean) {
super();
}
export class BindingPipe extends AST {
constructor(public exp: AST, public name: string, public args: List<any>) { super(); }
visit(visitor: AstVisitor) { return visitor.visitPipe(this); }
}
@ -336,7 +333,7 @@ export interface AstVisitor {
visitChain(ast: Chain): any;
visitConditional(ast: Conditional): any;
visitIf(ast: If): any;
visitPipe(ast: Pipe): any;
visitPipe(ast: BindingPipe): any;
visitFunctionCall(ast: FunctionCall): any;
visitImplicitReceiver(ast: ImplicitReceiver): any;
visitInterpolation(ast: Interpolation): any;
@ -394,8 +391,8 @@ export class AstTransformer implements AstVisitor {
ast.falseExp.visit(this));
}
visitPipe(ast: Pipe) {
return new Pipe(ast.exp.visit(this), ast.name, this.visitAll(ast.args), ast.inBinding);
visitPipe(ast: BindingPipe) {
return new BindingPipe(ast.exp.visit(this), ast.name, this.visitAll(ast.args));
}
visitKeyedAccess(ast: KeyedAccess) {

View File

@ -34,7 +34,7 @@ import {
PrefixNot,
Conditional,
If,
Pipe,
BindingPipe,
Assignment,
Chain,
KeyedAccess,
@ -73,15 +73,6 @@ export class Parser {
return new ASTWithSource(ast, input, location);
}
addPipes(bindingAst: ASTWithSource, pipes: List<string>): ASTWithSource {
if (ListWrapper.isEmpty(pipes)) return bindingAst;
var res: AST = ListWrapper.reduce(
pipes, (result, currentPipeName) => new Pipe(result, currentPipeName, [], false),
bindingAst.ast);
return new ASTWithSource(res, bindingAst.source, bindingAst.location);
}
parseTemplateBindings(input: string, location: any): List<TemplateBinding> {
var tokens = this._lexer.tokenize(input);
return new _ParseAST(input, location, tokens, this._reflector, false).parseTemplateBindings();
@ -224,7 +215,7 @@ class _ParseAST {
while (this.optionalCharacter($COLON)) {
args.push(this.parsePipe());
}
result = new Pipe(result, name, args, true);
result = new BindingPipe(result, name, args);
} while (this.optionalOperator("|"));
}