// ============================================================ // Code-generation of template tags // The `CodeGen` class currently has no instance state, but in theory // it could be useful to track per-function state, like whether we // need to emit `var self = this` or not. var CodeGen = SpacebarsCompiler.CodeGen = function () {}; var builtInBlockHelpers = SpacebarsCompiler._builtInBlockHelpers = { 'if': 'Blaze.If', 'unless': 'Blaze.Unless', 'with': 'Spacebars.With', 'each': 'Blaze.Each' }; // Mapping of "macros" which, when preceded by `Template.`, expand // to special code rather than following the lookup rules for dotted // symbols. var builtInTemplateMacros = { // `view` is a local variable defined in the generated render // function for the template in which `Template.contentBlock` or // `Template.elseBlock` is invoked. 'contentBlock': 'view.templateContentBlock', 'elseBlock': 'view.templateElseBlock', // Confusingly, this makes `{{> Template.dynamic}}` an alias // for `{{> __dynamic}}`, where "__dynamic" is the template that // implements the dynamic template feature. 'dynamic': 'Template.__dynamic' }; // A "reserved name" can't be used as a