parent
a768f2e124
commit
3496c8ac54
@ -16,9 +16,8 @@ import {
|
|||||||
RECORD_TYPE_KEYED_ACCESS,
|
RECORD_TYPE_KEYED_ACCESS,
|
||||||
RECORD_TYPE_INVOKE_FORMATTER,
|
RECORD_TYPE_INVOKE_FORMATTER,
|
||||||
RECORD_TYPE_STRUCTURAL_CHECK,
|
RECORD_TYPE_STRUCTURAL_CHECK,
|
||||||
RECORD_TYPE_INTERPOLATE,
|
RECORD_TYPE_INTERPOLATE
|
||||||
ProtoChangeDetector
|
} from './proto_record';
|
||||||
} from './proto_change_detector';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The code generator takes a list of proto records and creates a function/class
|
* The code generator takes a list of proto records and creates a function/class
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {isPresent, isBlank, BaseException, Type} from 'angular2/src/facade/lang';
|
import {isPresent, isBlank, BaseException, Type} from 'angular2/src/facade/lang';
|
||||||
import {List, ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
import {List, ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
||||||
import {ContextWithVariableBindings} from './parser/context_with_variable_bindings';
|
import {ContextWithVariableBindings} from './parser/context_with_variable_bindings';
|
||||||
import {ProtoRecord} from './proto_change_detector';
|
import {ProtoRecord} from './proto_record';
|
||||||
import {ExpressionChangedAfterItHasBeenChecked} from './exceptions';
|
import {ExpressionChangedAfterItHasBeenChecked} from './exceptions';
|
||||||
import {NO_CHANGE} from './pipes/pipe';
|
import {NO_CHANGE} from './pipes/pipe';
|
||||||
import {ChangeRecord, ChangeDetector, CHECK_ALWAYS, CHECK_ONCE, CHECKED, DETACHED} from './interfaces';
|
import {ChangeRecord, ChangeDetector, CHECK_ALWAYS, CHECK_ONCE, CHECKED, DETACHED} from './interfaces';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {isPresent} from 'angular2/src/facade/lang';
|
import {isPresent} from 'angular2/src/facade/lang';
|
||||||
import {List, ListWrapper, Map, MapWrapper} from 'angular2/src/facade/collection';
|
import {List, ListWrapper, Map, MapWrapper} from 'angular2/src/facade/collection';
|
||||||
import {RECORD_TYPE_SELF, ProtoRecord} from './proto_change_detector';
|
import {RECORD_TYPE_SELF, ProtoRecord} from './proto_record';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes "duplicate" records. It assuming that record evaluation does not
|
* Removes "duplicate" records. It assuming that record evaluation does not
|
||||||
|
@ -18,9 +18,8 @@ import {
|
|||||||
RECORD_TYPE_KEYED_ACCESS,
|
RECORD_TYPE_KEYED_ACCESS,
|
||||||
RECORD_TYPE_INVOKE_FORMATTER,
|
RECORD_TYPE_INVOKE_FORMATTER,
|
||||||
RECORD_TYPE_STRUCTURAL_CHECK,
|
RECORD_TYPE_STRUCTURAL_CHECK,
|
||||||
RECORD_TYPE_INTERPOLATE,
|
RECORD_TYPE_INTERPOLATE
|
||||||
ProtoChangeDetector
|
} from './proto_record';
|
||||||
} from './proto_change_detector';
|
|
||||||
|
|
||||||
import {ExpressionChangedAfterItHasBeenChecked, ChangeDetectionError} from './exceptions';
|
import {ExpressionChangedAfterItHasBeenChecked, ChangeDetectionError} from './exceptions';
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {ProtoRecord} from './proto_change_detector';
|
import {ProtoRecord} from './proto_record';
|
||||||
|
|
||||||
export class ExpressionChangedAfterItHasBeenChecked extends Error {
|
export class ExpressionChangedAfterItHasBeenChecked extends Error {
|
||||||
message:string;
|
message:string;
|
||||||
|
@ -31,65 +31,19 @@ import {PipeRegistry} from './pipes/pipe_registry';
|
|||||||
|
|
||||||
import {coalesce} from './coalesce';
|
import {coalesce} from './coalesce';
|
||||||
|
|
||||||
export const RECORD_TYPE_SELF = 0;
|
import {
|
||||||
export const RECORD_TYPE_CONST = 1;
|
ProtoRecord,
|
||||||
export const RECORD_TYPE_PRIMITIVE_OP = 2;
|
RECORD_TYPE_SELF,
|
||||||
export const RECORD_TYPE_PROPERTY = 3;
|
RECORD_TYPE_PROPERTY,
|
||||||
export const RECORD_TYPE_INVOKE_METHOD = 4;
|
RECORD_TYPE_INVOKE_METHOD,
|
||||||
export const RECORD_TYPE_INVOKE_CLOSURE = 5;
|
RECORD_TYPE_CONST,
|
||||||
export const RECORD_TYPE_KEYED_ACCESS = 6;
|
RECORD_TYPE_INVOKE_CLOSURE,
|
||||||
export const RECORD_TYPE_INVOKE_FORMATTER = 7;
|
RECORD_TYPE_PRIMITIVE_OP,
|
||||||
export const RECORD_TYPE_STRUCTURAL_CHECK = 8;
|
RECORD_TYPE_KEYED_ACCESS,
|
||||||
export const RECORD_TYPE_INTERPOLATE = 9;
|
RECORD_TYPE_INVOKE_FORMATTER,
|
||||||
|
RECORD_TYPE_STRUCTURAL_CHECK,
|
||||||
export class ProtoRecord {
|
RECORD_TYPE_INTERPOLATE
|
||||||
mode:number;
|
} from './proto_record';
|
||||||
name:string;
|
|
||||||
funcOrValue:any;
|
|
||||||
args:List;
|
|
||||||
fixedArgs:List;
|
|
||||||
contextIndex:number;
|
|
||||||
selfIndex:number;
|
|
||||||
bindingMemento:any;
|
|
||||||
directiveMemento:any;
|
|
||||||
lastInBinding:boolean;
|
|
||||||
lastInDirective:boolean;
|
|
||||||
expressionAsString:string;
|
|
||||||
|
|
||||||
constructor(mode:number,
|
|
||||||
name:string,
|
|
||||||
funcOrValue,
|
|
||||||
args:List,
|
|
||||||
fixedArgs:List,
|
|
||||||
contextIndex:number,
|
|
||||||
selfIndex:number,
|
|
||||||
bindingMemento:any,
|
|
||||||
directiveMemento:any,
|
|
||||||
expressionAsString:string,
|
|
||||||
lastInBinding:boolean,
|
|
||||||
lastInDirective:boolean) {
|
|
||||||
|
|
||||||
this.mode = mode;
|
|
||||||
this.name = name;
|
|
||||||
this.funcOrValue = funcOrValue;
|
|
||||||
this.args = args;
|
|
||||||
this.fixedArgs = fixedArgs;
|
|
||||||
this.contextIndex = contextIndex;
|
|
||||||
this.selfIndex = selfIndex;
|
|
||||||
this.bindingMemento = bindingMemento;
|
|
||||||
this.directiveMemento = directiveMemento;
|
|
||||||
this.lastInBinding = lastInBinding;
|
|
||||||
this.lastInDirective = lastInDirective;
|
|
||||||
this.expressionAsString = expressionAsString;
|
|
||||||
}
|
|
||||||
|
|
||||||
isPureFunction():boolean {
|
|
||||||
return this.mode === RECORD_TYPE_INTERPOLATE ||
|
|
||||||
this.mode === RECORD_TYPE_INVOKE_FORMATTER ||
|
|
||||||
this.mode === RECORD_TYPE_PRIMITIVE_OP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export class ProtoChangeDetector {
|
export class ProtoChangeDetector {
|
||||||
addAst(ast:AST, bindingMemento:any, directiveMemento:any = null, structural:boolean = false){}
|
addAst(ast:AST, bindingMemento:any, directiveMemento:any = null, structural:boolean = false){}
|
||||||
|
60
modules/angular2/src/change_detection/proto_record.js
vendored
Normal file
60
modules/angular2/src/change_detection/proto_record.js
vendored
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import {List} from 'angular2/src/facade/collection';
|
||||||
|
|
||||||
|
export const RECORD_TYPE_SELF = 0;
|
||||||
|
export const RECORD_TYPE_CONST = 1;
|
||||||
|
export const RECORD_TYPE_PRIMITIVE_OP = 2;
|
||||||
|
export const RECORD_TYPE_PROPERTY = 3;
|
||||||
|
export const RECORD_TYPE_INVOKE_METHOD = 4;
|
||||||
|
export const RECORD_TYPE_INVOKE_CLOSURE = 5;
|
||||||
|
export const RECORD_TYPE_KEYED_ACCESS = 6;
|
||||||
|
export const RECORD_TYPE_INVOKE_FORMATTER = 7;
|
||||||
|
export const RECORD_TYPE_STRUCTURAL_CHECK = 8;
|
||||||
|
export const RECORD_TYPE_INTERPOLATE = 9;
|
||||||
|
|
||||||
|
export class ProtoRecord {
|
||||||
|
mode:number;
|
||||||
|
name:string;
|
||||||
|
funcOrValue:any;
|
||||||
|
args:List;
|
||||||
|
fixedArgs:List;
|
||||||
|
contextIndex:number;
|
||||||
|
selfIndex:number;
|
||||||
|
bindingMemento:any;
|
||||||
|
directiveMemento:any;
|
||||||
|
lastInBinding:boolean;
|
||||||
|
lastInDirective:boolean;
|
||||||
|
expressionAsString:string;
|
||||||
|
|
||||||
|
constructor(mode:number,
|
||||||
|
name:string,
|
||||||
|
funcOrValue,
|
||||||
|
args:List,
|
||||||
|
fixedArgs:List,
|
||||||
|
contextIndex:number,
|
||||||
|
selfIndex:number,
|
||||||
|
bindingMemento:any,
|
||||||
|
directiveMemento:any,
|
||||||
|
expressionAsString:string,
|
||||||
|
lastInBinding:boolean,
|
||||||
|
lastInDirective:boolean) {
|
||||||
|
|
||||||
|
this.mode = mode;
|
||||||
|
this.name = name;
|
||||||
|
this.funcOrValue = funcOrValue;
|
||||||
|
this.args = args;
|
||||||
|
this.fixedArgs = fixedArgs;
|
||||||
|
this.contextIndex = contextIndex;
|
||||||
|
this.selfIndex = selfIndex;
|
||||||
|
this.bindingMemento = bindingMemento;
|
||||||
|
this.directiveMemento = directiveMemento;
|
||||||
|
this.lastInBinding = lastInBinding;
|
||||||
|
this.lastInDirective = lastInDirective;
|
||||||
|
this.expressionAsString = expressionAsString;
|
||||||
|
}
|
||||||
|
|
||||||
|
isPureFunction():boolean {
|
||||||
|
return this.mode === RECORD_TYPE_INTERPOLATE ||
|
||||||
|
this.mode === RECORD_TYPE_INVOKE_FORMATTER ||
|
||||||
|
this.mode === RECORD_TYPE_PRIMITIVE_OP;
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
import {ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach} from 'angular2/test_lib';
|
import {ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {coalesce} from 'angular2/src/change_detection/coalesce';
|
import {coalesce} from 'angular2/src/change_detection/coalesce';
|
||||||
import {RECORD_TYPE_SELF, ProtoRecord} from 'angular2/src/change_detection/proto_change_detector';
|
import {RECORD_TYPE_SELF, ProtoRecord} from 'angular2/src/change_detection/proto_record';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
function r(funcOrValue, args, contextIndex, selfIndex, lastInBinding = false) {
|
function r(funcOrValue, args, contextIndex, selfIndex, lastInBinding = false) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user