You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/compiler-api.md
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -204,6 +204,12 @@ var scanner = new ImportScanner();
204
204
scanner.accept(ast);
205
205
```
206
206
207
+
The current node's ancestors will be maintained in the `parents` array, with the most recent parent listed first.
208
+
209
+
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.
210
+
211
+
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.
212
+
207
213
## JavaScript Compiler
208
214
209
215
The `Handlebars.JavaScriptCompiler` object has a number of methods that may be customized to alter the output of the compiler:
0 commit comments