feat(change_detector): add support for formatters
This commit is contained in:
@ -16,6 +16,7 @@ export const PROTO_RECORD_PROPERTY = 'property';
|
||||
export class ProtoRecord {
|
||||
@FIELD('final watchGroup:wg.ProtoWatchGroup')
|
||||
@FIELD('final context:Object')
|
||||
@FIELD('final funcOrValue:Object')
|
||||
@FIELD('final arity:int')
|
||||
@FIELD('final dest')
|
||||
|
||||
|
@ -1,12 +1,14 @@
|
||||
import {ProtoRecord, Record, PROTO_RECORD_CONST, PROTO_RECORD_FUNC, PROTO_RECORD_PROPERTY} from './record';
|
||||
import {FIELD, IMPLEMENTS, isBlank, isPresent, int, toBool, autoConvertAdd, BaseException} from 'facade/lang';
|
||||
import {ListWrapper} from 'facade/collection';
|
||||
import {AST, AccessMember, ImplicitReceiver, AstVisitor, LiteralPrimitive, Binary} from './parser/ast';
|
||||
import {AST, AccessMember, ImplicitReceiver, AstVisitor, LiteralPrimitive, Binary, Formatter} from './parser/ast';
|
||||
|
||||
export class ProtoWatchGroup {
|
||||
@FIELD('headRecord:ProtoRecord')
|
||||
@FIELD('tailRecord:ProtoRecord')
|
||||
constructor() {
|
||||
constructor(formatters) {
|
||||
this.formatters = formatters;
|
||||
|
||||
this.headRecord = null;
|
||||
this.tailRecord = null;
|
||||
}
|
||||
@ -179,6 +181,15 @@ class ProtoRecordCreator {
|
||||
this.add(record);
|
||||
}
|
||||
|
||||
visitFormatter(ast:Formatter, dest) {
|
||||
var formatter = this.protoWatchGroup.formatters[ast.name];
|
||||
var record = this.construct(PROTO_RECORD_FUNC, formatter, ast.allArgs.length, dest);
|
||||
for (var i = 0; i < ast.allArgs.length; ++i) {
|
||||
ast.allArgs[i].visit(this, new Destination(record, i));
|
||||
}
|
||||
this.add(record);
|
||||
}
|
||||
|
||||
createRecordsFromAST(ast:AST, memento){
|
||||
ast.visit(this, memento);
|
||||
}
|
||||
|
Reference in New Issue
Block a user