Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// the CP is still valid, and if so we use the cached value. If not, then
// we create a lazy chain lookup, and the next time the CP is caluculated,
// it will update that lazy chain.
let lastRevision = getLastRevisionFor(current, segment);
if (validate(propertyTag, lastRevision)) {
current = peekCacheFor(current).get(segment);
} else {
let lazyChains = metaFor(current).writableLazyChainsFor(segment);
let rest = path.substr(segmentEnd + 1);
let placeholderTag = lazyChains[rest];
if (placeholderTag === undefined) {
placeholderTag = lazyChains[rest] = createUpdatableTag();
}
chainTags.push(placeholderTag);
break;
}
}
}
return chainTags;
}
writableTag() {
assert(
this.isMetaDestroyed()
? `Cannot create a new tag for \`${toString(this.source)}\` after it has been destroyed.`
: '',
!this.isMetaDestroyed()
);
let ret = this._tag;
if (ret === undefined) {
ret = this._tag = createUpdatableTag();
}
return ret;
}
constructor(
sourceReference: VersionedPathReference,
pathReference: PathReference
) {
super();
this.sourceReference = sourceReference;
this.pathReference = pathReference;
this.lastPath = null;
this.innerReference = NULL_REFERENCE;
let innerTag = (this.innerTag = createUpdatableTag());
this.tag = combine([sourceReference.tag, pathReference.tag, innerTag]);
}
constructor(cond: any, truthy: any, falsy: any) {
super();
this.branchTag = createUpdatableTag();
this.tag = combine([cond.tag, this.branchTag]);
this.cond = cond;
this.truthy = truthy;
this.falsy = falsy;
}
if (objectType !== 'function' && (objectType !== 'object' || object === null)) {
return CONSTANT_TAG;
}
let meta = _meta === undefined ? metaFor(object) : _meta;
if (!(propertyKey in object) && typeof object[UNKNOWN_PROPERTY_TAG] === 'function') {
return object[UNKNOWN_PROPERTY_TAG](propertyKey);
}
let tags = meta.writableTags();
let tag = tags[propertyKey];
if (tag) {
return tag;
}
let newTag = createUpdatableTag();
if (DEBUG) {
setupMandatorySetter!(object, propertyKey);
(newTag as any)._propertyKey = propertyKey;
}
return (tags[propertyKey] = newTag);
}