當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript parser.Parser類代碼示例

本文整理匯總了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;未經允許,請勿轉載。