compute() { let { lastPath, innerReference, innerTag } = this; let path = this.lastPath = this.pathReference.value(); if (path !== lastPath) { if (path !== undefined && path !== null) { let pathType = typeof path; if (pathType === 'string') { innerReference = referenceFromParts(this.sourceReference, path.split('.')); } else if (pathType === 'number') { innerReference = this.sourceReference.get('' + path); } innerTag.update(innerReference.tag); } else { innerReference = NULL_REFERENCE; innerTag.update(CONSTANT_TAG); } this.innerReference = innerReference; } return innerReference.value(); }
static create(sourceReference, pathReference) { if (isConst(pathReference)) { let parts = pathReference.value().split('.'); return referenceFromParts(sourceReference, parts); } else { return new GetHelperReference(sourceReference, pathReference); } }