summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2014-12-26 11:32:30 -0600
committerkpdecker <kpdecker@gmail.com>2014-12-26 11:32:30 -0600
commit9ff3daf78556a62829b8982c467243dc810a8a6b (patch)
tree10418fff6c5b4f2039487048c8eb932de95834c9 /docs
parent8babe059534acda388672491108c2d6f1ac2a431 (diff)
downloadhandlebars.js-9ff3daf78556a62829b8982c467243dc810a8a6b.zip
handlebars.js-9ff3daf78556a62829b8982c467243dc810a8a6b.tar.gz
handlebars.js-9ff3daf78556a62829b8982c467243dc810a8a6b.tar.bz2
Add parent tracking and mutation to AST visitors
Fixes #916
Diffstat (limited to 'docs')
-rw-r--r--docs/compiler-api.md6
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/compiler-api.md b/docs/compiler-api.md
index 98ca894..74af672 100644
--- a/docs/compiler-api.md
+++ b/docs/compiler-api.md
@@ -204,6 +204,12 @@ var scanner = new ImportScanner();
scanner.accept(ast);
```
+The current node's ancestors will be maintained in the `parents` array, with the most recent parent listed first.
+
+The visitor may also be configured to operate in mutation mode by setting the `mutation` field to true. When in this mode, handler methods may return any valid AST node and it will replace the one they are currently operating on. Returning `false` will remove the given value (if valid) and returning `undefined` will leave the node in tact. This return structure only apply to mutation mode and non-mutation mode visitors are free to return whatever values they wish.
+
+Implementors that may need to support mutation mode are encouraged to utilize the `acceptKey`, `acceptRequired` and `acceptArray` helpers which provide the conditional overwrite behavior as well as implement sanity checks where pertinent.
+
## JavaScript Compiler
The `Handlebars.JavaScriptCompiler` object has a number of methods that may be customized to alter the output of the compiler: