feat(change_detector): cleanup

This commit is contained in:
vsavkin
2014-11-11 18:36:44 -08:00
parent 34d76f1c73
commit 03410850b4
3 changed files with 113 additions and 131 deletions

View File

@ -95,25 +95,26 @@ export class Record {
this.funcOrValue = null;
this.args = null;
if (protoRecord.recordType === PROTO_RECORD_CONST) {
var type = protoRecord.recordType;
if (type === PROTO_RECORD_CONST) {
this.mode = MODE_STATE_CONST;
this.funcOrValue = protoRecord.funcOrValue;
} else if (protoRecord.recordType === PROTO_RECORD_PURE_FUNCTION) {
} else if (type === PROTO_RECORD_PURE_FUNCTION) {
this.mode = MODE_STATE_INVOKE_PURE_FUNCTION;
this.funcOrValue = protoRecord.funcOrValue;
this.args = ListWrapper.createFixedSize(protoRecord.arity);
} else if (protoRecord.recordType === PROTO_RECORD_METHOD) {
} else if (type === PROTO_RECORD_METHOD) {
this.mode = MODE_STATE_INVOKE_METHOD;
this.funcOrValue = protoRecord.funcOrValue;
this.args = ListWrapper.createFixedSize(protoRecord.arity);
} else if (protoRecord.recordType === PROTO_RECORD_CLOSURE) {
} else if (type === PROTO_RECORD_CLOSURE) {
this.mode = MODE_STATE_INVOKE_CLOSURE;
this.args = ListWrapper.createFixedSize(protoRecord.arity);
} else if (protoRecord.recordType === PROTO_RECORD_PROPERTY) {
} else if (type === PROTO_RECORD_PROPERTY) {
this.mode = MODE_STATE_PROPERTY;
this.funcOrValue = protoRecord.funcOrValue;
}
@ -210,7 +211,6 @@ const MODE_STATE_LIST = 0x0006;
const MODE_STATE_CONST = 0x0007;
function isSame(a, b) {
if (a instanceof String && b instanceof String) return a == b;
if (a === b) return true;
if ((a !== a) && (b !== b)) return true;
return false;

View File

@ -9,7 +9,7 @@ import {AST, AccessMember, ImplicitReceiver, AstVisitor, LiteralPrimitive,
export class ProtoWatchGroup {
@FIELD('headRecord:ProtoRecord')
@FIELD('tailRecord:ProtoRecord')
constructor(formatters) {
constructor(formatters=null) {
this.formatters = formatters;
this.headRecord = null;
@ -154,17 +154,6 @@ class ProtoRecordCreator {
//do nothing
}
// TODO: add tests for this method!
visitLiteralPrimitive(ast:LiteralPrimitive) {
// do nothing
}
// TODO: add tests for this method!
visitBinary(ast:Binary) {
ast.left.visit(this);
ast.right.visit(this);
}
visitLiteralPrimitive(ast:LiteralPrimitive, dest) {
this.add(this.construct(PROTO_RECORD_CONST, ast.value, 0, dest));
}