Skip to content

Commit

Permalink
Introduce macro backdoor
Browse files Browse the repository at this point in the history
  • Loading branch information
chadhietala committed Jan 17, 2017
1 parent 85bfc2e commit 630e1e9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/ember-glimmer/lib/syntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ function refineBlockSyntax(sexp, builder) {
return false;
}

let experimentalMacros = [];

// This is a private API to allow for expiremental macros
// to be created in user space. Registering a macro should
// should be done in an initializer.
export function registerMacros(macro) {
experimentalMacros.push(macro);
}

export function populateMacros(blocks, inlines) {
inlines.add('outlet', outletMacro);
inlines.add('component', inlineComponentMacro);
Expand All @@ -81,5 +90,10 @@ export function populateMacros(blocks, inlines) {
blocks.add('-with-dynamic-vars', _withDynamicVarsMacro);
blocks.add('-in-element', _inElementMacro);
blocks.addMissing(refineBlockSyntax);

for (let i = 0; i < experimentalMacros.length; i++) {
let macro = experimentalMacros[i];
macro(blocks, inlines);
}
return { blocks, inlines };
}

0 comments on commit 630e1e9

Please sign in to comment.