Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ import {
RECORD_TYPE_KEYED_ACCESS,
RECORD_TYPE_INVOKE_FORMATTER,
RECORD_TYPE_STRUCTURAL_CHECK,
RECORD_TYPE_INTERPOLATE,
ProtoChangeDetector
} from './proto_change_detector';
RECORD_TYPE_INTERPOLATE
} from './proto_record';

/**
* The code generator takes a list of proto records and creates a function/class
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {isPresent, isBlank, BaseException, Type} from 'angular2/src/facade/lang';
import {List, ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
import {ContextWithVariableBindings} from './parser/context_with_variable_bindings';
import {ProtoRecord} from './proto_change_detector';
import {ProtoRecord} from './proto_record';
import {ExpressionChangedAfterItHasBeenChecked} from './exceptions';
import {NO_CHANGE} from './pipes/pipe';
import {ChangeRecord, ChangeDetector, CHECK_ALWAYS, CHECK_ONCE, CHECKED, DETACHED} from './interfaces';
Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/src/change_detection/coalesce.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {isPresent} from 'angular2/src/facade/lang';
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ import {
RECORD_TYPE_KEYED_ACCESS,
RECORD_TYPE_INVOKE_FORMATTER,
RECORD_TYPE_STRUCTURAL_CHECK,
RECORD_TYPE_INTERPOLATE,
ProtoChangeDetector
} from './proto_change_detector';
RECORD_TYPE_INTERPOLATE
} from './proto_record';

import {ExpressionChangedAfterItHasBeenChecked, ChangeDetectionError} from './exceptions';

Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/src/change_detection/exceptions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ProtoRecord} from './proto_change_detector';
import {ProtoRecord} from './proto_record';

export class ExpressionChangedAfterItHasBeenChecked extends Error {
message:string;
Expand Down
72 changes: 13 additions & 59 deletions modules/angular2/src/change_detection/proto_change_detector.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,65 +31,19 @@ import {PipeRegistry} from './pipes/pipe_registry';

import {coalesce} from './coalesce';

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;
}
}

import {
ProtoRecord,
RECORD_TYPE_SELF,
RECORD_TYPE_PROPERTY,
RECORD_TYPE_INVOKE_METHOD,
RECORD_TYPE_CONST,
RECORD_TYPE_INVOKE_CLOSURE,
RECORD_TYPE_PRIMITIVE_OP,
RECORD_TYPE_KEYED_ACCESS,
RECORD_TYPE_INVOKE_FORMATTER,
RECORD_TYPE_STRUCTURAL_CHECK,
RECORD_TYPE_INTERPOLATE
} from './proto_record';

export class ProtoChangeDetector {
addAst(ast:AST, bindingMemento:any, directiveMemento:any = null, structural:boolean = false){}
Expand Down
60 changes: 60 additions & 0 deletions modules/angular2/src/change_detection/proto_record.js
Original file line number Diff line number Diff line change
@@ -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;
}
}
2 changes: 1 addition & 1 deletion modules/angular2/test/change_detection/coalesce_spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach} from 'angular2/test_lib';

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() {
function r(funcOrValue, args, contextIndex, selfIndex, lastInBinding = false) {
Expand Down