UNPKG

angular2

Version:

Angular 2 - a web framework for modern web apps

59 lines (58 loc) 3.11 kB
export var RecordType; (function (RecordType) { RecordType[RecordType["Self"] = 0] = "Self"; RecordType[RecordType["Const"] = 1] = "Const"; RecordType[RecordType["PrimitiveOp"] = 2] = "PrimitiveOp"; RecordType[RecordType["PropertyRead"] = 3] = "PropertyRead"; RecordType[RecordType["PropertyWrite"] = 4] = "PropertyWrite"; RecordType[RecordType["Local"] = 5] = "Local"; RecordType[RecordType["InvokeMethod"] = 6] = "InvokeMethod"; RecordType[RecordType["InvokeClosure"] = 7] = "InvokeClosure"; RecordType[RecordType["KeyedRead"] = 8] = "KeyedRead"; RecordType[RecordType["KeyedWrite"] = 9] = "KeyedWrite"; RecordType[RecordType["Pipe"] = 10] = "Pipe"; RecordType[RecordType["Interpolate"] = 11] = "Interpolate"; RecordType[RecordType["SafeProperty"] = 12] = "SafeProperty"; RecordType[RecordType["CollectionLiteral"] = 13] = "CollectionLiteral"; RecordType[RecordType["SafeMethodInvoke"] = 14] = "SafeMethodInvoke"; RecordType[RecordType["DirectiveLifecycle"] = 15] = "DirectiveLifecycle"; RecordType[RecordType["Chain"] = 16] = "Chain"; RecordType[RecordType["SkipRecordsIf"] = 17] = "SkipRecordsIf"; RecordType[RecordType["SkipRecordsIfNot"] = 18] = "SkipRecordsIfNot"; RecordType[RecordType["SkipRecords"] = 19] = "SkipRecords"; // Skip records unconditionally })(RecordType || (RecordType = {})); export class ProtoRecord { constructor(mode, name, funcOrValue, args, fixedArgs, contextIndex, directiveIndex, selfIndex, bindingRecord, lastInBinding, lastInDirective, argumentToPureFunction, referencedBySelf, propertyBindingIndex) { this.mode = mode; this.name = name; this.funcOrValue = funcOrValue; this.args = args; this.fixedArgs = fixedArgs; this.contextIndex = contextIndex; this.directiveIndex = directiveIndex; this.selfIndex = selfIndex; this.bindingRecord = bindingRecord; this.lastInBinding = lastInBinding; this.lastInDirective = lastInDirective; this.argumentToPureFunction = argumentToPureFunction; this.referencedBySelf = referencedBySelf; this.propertyBindingIndex = propertyBindingIndex; } isPureFunction() { return this.mode === RecordType.Interpolate || this.mode === RecordType.CollectionLiteral; } isUsedByOtherRecord() { return !this.lastInBinding || this.referencedBySelf; } shouldBeChecked() { return this.argumentToPureFunction || this.lastInBinding || this.isPureFunction() || this.isPipeRecord(); } isPipeRecord() { return this.mode === RecordType.Pipe; } isConditionalSkipRecord() { return this.mode === RecordType.SkipRecordsIfNot || this.mode === RecordType.SkipRecordsIf; } isUnconditionalSkipRecord() { return this.mode === RecordType.SkipRecords; } isSkipRecord() { return this.isConditionalSkipRecord() || this.isUnconditionalSkipRecord(); } isLifeCycleRecord() { return this.mode === RecordType.DirectiveLifecycle; } }