Skip to content

Instantly share code, notes, and snippets.

@justinbmeyer
Created September 7, 2018 02:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinbmeyer/95e4ff6758d4dba4bb8a910809ed5d23 to your computer and use it in GitHub Desktop.
Save justinbmeyer/95e4ff6758d4dba4bb8a910809ed5d23 to your computer and use it in GitHub Desktop.
// var keyInfo = Scope.keyInfo(key),
// parent,
// propName;
//
// if(keyInfo.remainingKey === "this") {
// // this prevents reading of observables
// options.readCompute = false;
// parent = this.readKeyInfo(keyInfo, options).value;
// return { parent: parent, how: "setValue" };
// }
// else if(keyInfo.isContextBased) {
// var props = keyInfo.remainingKey.split(".");
// propName = props.pop();
// keyInfo.remainingKey = props.join(".") || "this";
// parent = this.readKeyInfo(keyInfo, options).value;
// }
// else {
// // How should {{foo}} be treated? We must look for a scope with a `foo` property ideally
// // otherwise, we should default to the first
// var props = keyInfo.remainingKey.split(".");
// propName = props.pop();
// if(props.length > 0) {
// keyInfo.remainingKey = props.join(".") || "this";
// parent = this.readKeyInfo(keyInfo, options).value;
// } else {
// // what we really need to do is check each context and find the one whose
// // context has the key we are looking for
// // We have to resolve each context and do a `.get` on it ...
//
//
// // we need to get the `this` with the best odds, that's the variable or context
// // with this key in it
//
// var keyReads = stacheKey.reads(propName);
// var howToRead = {
// shouldExit: Scope.makeShouldExitOnSecondNormalContext(),
// shouldSkip: Scope.shouldSkipIfSpecial,
// shouldLookForHelper: false,
// read: function(context, keys){
// if( canReflect.hasKey(context, keys[0].key ) ) {
// return {
// parent: context,
// parentHasKey: true,
// value: undefined
// };
// } else {
// return {};
// }
// }
// };
// var walkResult = this._walk(keyReads, options, howToRead);
// parent = walkResult.thisArg;
// if(parent === undefined) {
// parent = walkResult.firstSearchedContext
// }
// }
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment