本文整理汇总了TypeScript中angular2/src/change_detection/parser/parser.Parser类的典型用法代码示例。如果您正苦于以下问题:TypeScript Parser类的具体用法?TypeScript Parser怎么用?TypeScript Parser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Parser类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it("should support interpolation", () => {
var parser = new Parser(new Lexer());
var pcd = createProtoChangeDetector();
var ast = parser.parseInterpolation("B{{a}}A", "location");
var cd = instantiate(pcd, dispatcher, [new BindingRecord(ast, "memo", null)]);
cd.hydrate(new TestData("value"), null);
cd.detectChanges();
expect(dispatcher.log).toEqual(["memo=BvalueA"]);
});
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:9,代码来源:change_detection_spec.ts
示例2: inject
inject([Parser], (p: Parser) => {
var builder = new ProtoRecordBuilder();
var ast = p.parseBinding("f(1,2)", "location");
builder.add(BindingRecord.createForElementProperty(ast, 0, "property"), []);
var isPureFunc = builder.records.map(r => r.argumentToPureFunction);
expect(isPureFunc).toEqual([false, false, false]);
}));
开发者ID:goderbauer,项目名称:angular,代码行数:8,代码来源:proto_record_builder_spec.ts
示例3: it
it('should set argumentToPureFunction flag', inject([Parser], (p: Parser) => {
var builder = new ProtoRecordBuilder();
var ast = p.parseBinding("[1,2]", "location"); // collection literal is a pure function
builder.add(BindingRecord.createForElementProperty(ast, 0, "property"), []);
var isPureFunc = builder.records.map(r => r.argumentToPureFunction);
expect(isPureFunc).toEqual([true, true, false]);
}));
开发者ID:goderbauer,项目名称:angular,代码行数:8,代码来源:proto_record_builder_spec.ts
示例4: ast
function ast(exp, location = 'location') {
var parser = new Parser(new Lexer());
return parser.parseBinding(exp, location);
}
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:4,代码来源:change_detection_spec.ts
示例5: _deserializeASTWithSource
private _deserializeASTWithSource(obj: StringMap<string, any>, data: string): AST {
// TODO: make ASTs serializable
var ast: AST;
switch (data) {
case "action":
ast = this._parser.parseAction(obj['input'], obj['location']);
break;
case "binding":
ast = this._parser.parseBinding(obj['input'], obj['location']);
break;
case "interpolation":
ast = this._parser.parseInterpolation(obj['input'], obj['location']);
break;
default:
throw "No AST deserializer for " + data;
}
return ast;
}
开发者ID:lavinjj,项目名称:angular,代码行数:18,代码来源:serializer.ts
注:本文中的angular2/src/change_detection/parser/parser.Parser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论