diff options
Diffstat (limited to 'docs/compiler-api.md')
-rw-r--r-- | docs/compiler-api.md | 6 |
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: |