Skip to content

Commit

Permalink
Improve comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Jul 17, 2019
1 parent d6f3a9f commit 1e8b656
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
32 changes: 16 additions & 16 deletions lib/mixins/property-effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -2670,34 +2670,34 @@ export const PropertyEffects = dedupingMixin(superClass => {
* Overview of binding flow:
*
* During finalization (`instanceBinding==false`, `wasPreBound==false`):
* `_bindTemplate(false)` called directly during finalization - parses the
* template (for the first time), and then assigns that _prototypical_
* `_bindTemplate(t, false)` called directly during finalization - parses
* the template (for the first time), and then assigns that _prototypical_
* template info to `__preboundTemplateInfo` _on the prototype_; note in
* this case `wasPreBound` is false; this is the first time we're binding
* it, thus we create accessors.
*
* During first stamping (`instanceBinding==true`, `wasPreBound==true`):
* `_stampTemplate` calls `_bindTemplate(true)`: the `templateInfo`
* `_stampTemplate` calls `_bindTemplate(t, true)`: the `templateInfo`
* returned matches the prebound one, and so this is `wasPreBound == true`
* state; thus we _skip_ creating accessors, but _do_ create a
* sub-instance of the template info to serve as the start of our linked
* list (needs to be an instance, not the prototypical one, so that we can
* add `nodeList` to it to contain the `nodeInfo`-ordered list of instance
* nodes for bindings, and so we can chain runtime-stamped template infos
* off of it). At this point, the call to `_stampTemplate` calls
* state; thus we _skip_ creating accessors, but _do_ create an instance
* of the template info to serve as the start of our linked list (needs to
* be an instance, not the prototypical one, so that we can add `nodeList`
* to it to contain the `nodeInfo`-ordered list of instance nodes for
* bindings, and so we can chain runtime-stamped template infos off of
* it). At this point, the call to `_stampTemplate` calls
* `applyTemplateInfo` for each nested `<template>` found during parsing
* to hand prototypical `_templateInfo` to them; we also pass the _parent_
* `templateInfo` to the `<template>` so that we have the instance-time
* parent to link the `templateInfo` under in the case it was
* runtime-stamped.
*
* During subsequent runtime stamping (`instanceBinding==true`,
* `wasPreBound==false`): `_stampTemplate` calls `_bindTemplate(true)` -
* here `templateInfo` is guaranteed to _not_ match the prebound one,
* `wasPreBound==false`): `_stampTemplate` calls `_bindTemplate(t, true)`
* - here `templateInfo` is guaranteed to _not_ match the prebound one,
* because it was either a different template altogether, or even if it
* was the same template, the step above created a sub-instance of the
* info; in this case `wasPreBound == false`, so we _do_ create accessors,
* _and_ link a sub-instance into the linked list.
* was the same template, the step above created a instance of the info;
* in this case `wasPreBound == false`, so we _do_ create accessors, _and_
* link a instance into the linked list.
*/

/**
Expand Down Expand Up @@ -2748,7 +2748,7 @@ export const PropertyEffects = dedupingMixin(superClass => {
// template, use the root template (the first stamped one) as the
// parent. Note, `parent` is the `templateInfo` instance for this
// template's parent (containing) template, which was set up in
// `applyTemplateContent`. While a given template's `parent` is set
// `applyTemplateInfo`. While a given template's `parent` is set
// apriori, it is only added to the parent's child list at the point
// that it is being bound, since a template may or may not ever be
// stamped, and may be stamped more than once (in which case instances
Expand Down Expand Up @@ -2863,7 +2863,7 @@ export const PropertyEffects = dedupingMixin(superClass => {
// Unlink template info; Note that while the child is unlinked from its
// parent list, a template's `parent` reference is never removed, since
// this is is determined by the tree structure and applied at
// `applyTemplateContent` time.
// `applyTemplateInfo` time.
let templateInfo = dom.templateInfo;
const {previousSibling, nextSibling, parent} = templateInfo;
if (previousSibling) {
Expand Down
4 changes: 2 additions & 2 deletions lib/mixins/template-stamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function applyEventListener(inst, node, nodeInfo) {
}

// push configuration references at configure time
function applyTemplateContent(inst, node, nodeInfo, parentTemplateInfo) {
function applyTemplateInfo(inst, node, nodeInfo, parentTemplateInfo) {
if (nodeInfo.templateInfo) {
// Give the node an instance of this templateInfo and set its parent
node._templateInfo = nodeInfo.templateInfo;
Expand Down Expand Up @@ -466,7 +466,7 @@ export const TemplateStamp = dedupingMixin(
for (let i=0, l=nodeInfo.length, info; (i<l) && (info=nodeInfo[i]); i++) {
let node = nodes[i] = findTemplateNode(dom, info);
applyIdToMap(this, dom.$, node, info);
applyTemplateContent(this, node, info, templateInfo);
applyTemplateInfo(this, node, info, templateInfo);
applyEventListener(this, node, info);
}
dom = /** @type {!StampedTemplate} */(dom); // eslint-disable-line no-self-assign
Expand Down

0 comments on commit 1e8b656

Please sign in to comment.