summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler
Commit message (Collapse)AuthorAgeFilesLines
* Use objects for hash value trackingkpdecker2016-03-111-1/+1
| | | | | | The use of arrays was incorrect for the data type and causing problems when hash keys conflicted with array behaviors. Fixes #1194
* Ensure that existing blockParams and depths are respected on dupe programsCharles O'Farrell2016-03-081-8/+10
| | | | Fixes #1186
* Throw exception if id tracking args are passedkpdecker2015-12-261-26/+26
| | | Fixes #1151
* Remove semi-documented _setup and _child APIskpdecker2015-12-121-14/+1
| | | These were a bad idea to begin with and without the trackIds implementation they don’t make much sense.
* Remove stringParams and trackIds modemachty2015-12-102-150/+2
| | | | Closes #1145
* Fix lint errors under latest eslintkpdecker2015-10-311-1/+1
|
* Fix iteration over undefined valueskpdecker2015-09-231-2/+3
| | | | | Allow for iteration on undefined values, but special case undefined and null to prevent rendering errors when not running in strict mode. Fixes #1093
* Fix failure when using decorators in partialskpdecker2015-09-021-0/+1
|
* Update to latest eslintkpdecker2015-09-013-5/+5
|
* Add explicitPartialContext compiler flagkpdecker2015-09-011-1/+5
| | | Fixes #1032
* Implement block decoratorskpdecker2015-08-223-4/+83
| | | | These allow for a given block to be wrapped in helper methods or metadata and allow for more control over the current container and method before the code is run.
* Add decorator parsingkpdecker2015-08-224-4/+19
|
* Add whitespace control to partial block statementskpdecker2015-08-221-1/+3
|
* Create validateClose helper methodkpdecker2015-08-221-20/+19
| | | | Avoid duplicating the logic needed to check for close block mismatches.
* Implement partial blockskpdecker2015-08-224-23/+71
| | | | | | This allows for failover for missing partials as well as limited templating ability through the `{{> @partial-block }}` partial special case. Partial fix for #1018
* Improve sanity checks in compiler and visitorkpdecker2015-08-222-2/+13
|
* Drop AST constructors in favor of JSONkpdecker2015-08-185-148/+65
| | | | | These were little more than object literal statements that were less clear due to their use of index-based arguments. Fixes #1077
* Pass container rather than exec as contextkpdecker2015-08-181-10/+10
| | | There is no real need for us to do `.call(container` other than for backwards compatibility with legacy versions. Using the 4.x release as a chance to optimize this behavior.
* Remove unused parameterskpdecker2015-08-181-2/+2
|
* Add ignoreStandalone compiler optionkpdecker2015-08-132-6/+10
| | | Fixes #1072
* Bulletproof AST.helpers.helperExpressionkpdecker2015-08-031-1/+3
| | | | | Avoid undefined values and potential false positives from other type values such as partials. Fixes #1055
* Use += in printerkpdecker2015-08-031-9/+9
|
* Enforce 100% code coveragekpdecker2015-08-032-14/+16
|
* Pass undefined fields to helpers in strict modekpdecker2015-08-032-9/+13
| | | | | This allows for `{{helper foo}}` to still operate under strict mode when `foo` is not defined on the context. This allows helpers to perform whatever existence checks they please so patterns like `{{#if foo}}{{foo}}{{/if}}` can be used to protect against missing values. Fixes #1063
* Handle this references properly in track id modekpdecker2015-08-031-2/+3
|
* Increase code coveragekpdecker2015-08-011-0/+1
|
* Fix escaping of non-javascript identifierskpdecker2015-08-011-1/+1
| | | | The ‘ character would cause invalid javascript to be generated as it was not properly escaped. Switching to JSON.stringify safely handles all potential unescaped cases.
* #1056 Fixed grammar for nested raw blocksEric Nielsen2015-07-151-2/+2
|
* Fix location information for programskpdecker2015-06-261-0/+25
| | | | | | | | There appears to be a bug in our use of jison causing the parent location information to be reported to programs. I wasn’t able to work through what might be causing this so instead using the location information of the statements collection to generate the proper location information. This is a bit of a hack but we are very far behind on the Jison release train and upgrading will likely be a less than pleasant task that doesn’t provide us much benefit. Fixes #1024
* Remove jshint completelykpdecker2015-04-272-6/+0
|
* Update for let and optional parameterskpdecker2015-04-209-177/+174
|
* Add full support for es6kpdecker2015-04-169-114/+123
| | | | | | | | Converts the tool chain to use babel, eslint, and webpack vs. the previous proprietary solutions. Additionally begins enforcing additional linting concerns as well as updates the code to reflect these rules. Fixes #855 Fixes #993
* Allow this references in literal statementskpdecker2015-04-141-2/+13
| | | Fixes #967
* Ignore branches tested without coverage monitoringkpdecker2015-04-071-1/+2
|
* Remove vestigial codekpdecker2015-04-071-5/+0
|
* Add undefined and null literal supportkpdecker2015-04-074-0/+30
| | | | | This adds the UndefinedLiteral and NullLiteral to AST. Fixes #990
* Avoid source-map import under AMDkpdecker2015-04-071-2/+12
| | | Fixes #989
* Fix typokpdecker2015-02-101-1/+1
|
* Handle all potential literal valueskpdecker2015-02-091-5/+9
| | | Adds support for literal helper names in a few missing cases such as block expressions and subexpressions.
* Transform literals to path expressions in mustache nodesMarcio Junior2015-02-081-5/+9
|
* Test compilation of literal values in mustachesMarcio Junior2015-02-081-1/+5
|
* Avoid direct references to sexpr in statementskpdecker2015-01-185-58/+58
| | | | | This allows us to avoid creating unnecessary AST nodes and avoids things like isHelper. Side effect of these changes is that @data functions can now have data parameters passed to them.
* Add support for dynamic partial nameskpdecker2015-01-185-5/+34
| | | | | | | | | Uses the subexpression syntax to allow for dynamic partial lookups. Ex: ``` {{> (helper) }} ``` Fixes #933
* Add missing reserved words so compiler knows to use array syntax:Matthew Flaschen2015-01-171-1/+2
| | | | | | | | | | | | | | | | * await * null * true * false IE 8 was failing to compile Handlebars-generated source code because it had helpers.null. I came up with this list by diffing https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords against the ones Handlebars already had. I added two corresponding tests for nameLookup.
* Merge pull request #932 from wycats/strictKevin Decker2014-12-311-7/+42
|\ | | | | Implement strict and assumeObject modes
| * Implement strict and assumeObject modeskpdecker2014-12-271-7/+42
| | | | | | | | | | | | | | | | Causes templates to throw when lookup fields are not defined within the context. Strict mode will throw when any field is omitted. assumeObjects mode maintains the existing behavior of outputting an empty response when fields are not defined but allows for performance/size optimizations by not doing safety checks for intermediate objects in the lookup chain. Strict mode effectively disables the helperMissing and inverse handling for blockHelperMissing as templates will throw rather than call those features for missing data fields. Fixes #651 Fixes #805
* | Merge branch 'master' into visitor-updatekpdecker2014-12-272-4/+4
|\ \ | |/
| * Fix block param evaluation under older IEkpdecker2014-12-271-2/+2
| |
| * Strip unnecessary whitespace in template outputkpdecker2014-12-271-1/+1
| |
| * Fix duplicate return statement on simple templateskpdecker2014-12-271-1/+1
| |
* | Fix case-insensitive file system compile issuekpdecker2014-12-261-1/+1
| |
* | Add parent tracking and mutation to AST visitorskpdecker2014-12-261-35/+78
|/ | | Fixes #916
* Bump code coveragekpdecker2014-12-262-2/+3
|
* Implement block parameterskpdecker2014-12-262-41/+106
| | | Fixes #907
* Expose AST helpers in public APIkpdecker2014-12-212-21/+26
|
* Update fix for #926 for 3.0 codelinekpdecker2014-12-171-1/+1
|
* Track depths on deduped childrenkpdecker2014-12-161-0/+2
| | | | | Fixes a very specific error case where deduped children won’t receive the depths object due to it being omitted by the caller when optimizing. Fixes #926
* Avoid unnecessary this. referencekpdecker2014-12-161-3/+3
|
* Fix remaining depth argkpdecker2014-12-161-1/+0
|
* Remove unused vars and add jshint checkingkpdecker2014-12-165-7/+3
|
* Remove Compiler.depths parameterkpdecker2014-12-162-19/+7
| | | | This is no longer necessary with the depths array tracking and adds compiler overhead.
* Add instructions for 'spec/mustache' to CONTRIBUTING.md, fix a few typos ↵Or Neeman2014-12-072-2/+2
| | | | elsewere
* Add basic docs for JavaScriptCompiler override APIkpdecker2014-11-291-9/+9
|
* Drop unused JavaScriptCompiler.namespace paramkpdecker2014-11-291-2/+0
|
* Move compileProgram out of visitor methodskpdecker2014-11-291-18/+18
|
* Track source node via accept call rather vs opcodekpdecker2014-11-291-41/+46
|
* s/Subexpression/SubExpression/kpdecker2014-11-291-1/+1
|
* Rework strip flags to make clearer at in AST levelkpdecker2014-11-284-188/+239
| | | Rather than keeping state in the AST, which requires some gymnastics, we create a separate visitor flow which does the top down iteration necessary to calculate all of the state needed for proper whitespace control evaluation.
* Move Jison parsing out of AST into helperskpdecker2014-11-282-38/+46
|
* Add original to BooleanLiteralkpdecker2014-11-281-1/+2
|
* Rename AST objects to match type nameskpdecker2014-11-282-16/+16
|
* Treat partial exec in a manner closer to helperskpdecker2014-11-273-34/+37
| | | This helps unify the code handling and will also be needed to support string/id tracking on partials.
* Update subexpression and hash AST constructskpdecker2014-11-276-105/+104
|
* Simplify Path and Sexpr calculated flagskpdecker2014-11-272-25/+38
|
* Replace DataNode and IdNode with PathNodekpdecker2014-11-265-55/+42
| | | This is a breaking change for string mode users as there is no longer a distinct type for data parameters. Instead data consumers should look for the @ prefix value.
* Update literal ast nodes for new speckpdecker2014-11-265-26/+23
|
* Update statement node ASTskpdecker2014-11-265-147/+133
|
* Update MustacheNode for new AST structurekpdecker2014-11-264-25/+14
|
* Update ProgramNode to better match SpiderMonkeykpdecker2014-11-266-61/+62
|
* Update AST location info to match SpiderMonkeykpdecker2014-11-266-43/+42
| | | Part of #889
* Optimize variable declarationkpdecker2014-11-251-2/+1
|
* Add parser support for block paramsMartin Muñoz2014-11-113-2/+14
|
* Propagate options for client compiled partialskpdecker2014-11-081-0/+2
| | | Fixes #901
* Merge branch 'remove-block-mustache' of github.com:mmun/handlebars.js into ↵kpdecker2014-11-084-26/+31
|\ | | | | | | | | | | | | | | mmun-remove-block-mustache Conflicts: lib/handlebars/compiler/helpers.js spec/parser.js
| * Remove RawBlockNode in favor of prepareRawBlock helperMartin Muñoz2014-11-052-9/+3
| |
| * Simplify BlockNode by removing intermediate MustacheNodeMartin Muñoz2014-11-024-20/+31
| |
* | Only provide aliases for multiple use callskpdecker2014-11-081-26/+39
| | | | | | Fixes #903
* | Provide default mapping for boilerplate codekpdecker2014-11-081-1/+5
| |
* | Generate source mapskpdecker2014-11-082-100/+275
| | | | | | | | | | | | Allow the precompiler to generate source maps when the srcFile parameter is passed. This refactors large chunks of the code generation pipeline, allowing metadata to be associated with code chunks as well as breaking out much of the code generation logic into a separate helper.
* | Include location information in all opcodeskpdecker2014-11-082-45/+50
| |
* | Merge pull request #892 from wycats/else-ifKevin Decker2014-11-081-7/+26
|\ \ | | | | | | Implement parser for else chaining of helpers
| * | Implement parser for else chaining of helperskpdecker2014-10-271-7/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allows users to chain multiple helpers together using their inverse callbacks. I.e. ``` {{#if foo}} {{else if bar}} {{else}} {{/if}} ``` The control flow here effectively causes the helpers to be nested. The above is actually syntactic sugar for this: ``` {{#if foo}} {{else}} {{#if bar}} {{else}} {{/if}} {{/if}} ``` Any helper may be used in this manner, the only requirement is they support normal calls and inverse calls. Introduces a breaking change in that `{{else foo}}` may no longer be used as a root level operator. Instead `{{^foo}}` must be used. Fixes #72.
* | | Simplify program generation logickpdecker2014-11-081-10/+2
| | |
* | | Bump test coveragekpdecker2014-11-082-3/+4
| | |
* | | Ignore unused code pathskpdecker2014-11-081-0/+2
| | | | | | | | | | | | We don’t want to remove these as the generic code may need it in the future, but these code paths are not triggered through the existing language constructs.
* | | Merge setupParams and setupOptionskpdecker2014-11-061-9/+2
| | |
* | | Simplify flushInline implementationkpdecker2014-11-051-19/+10
| | |
* | | Use terinary operator for inline appendskpdecker2014-11-051-7/+12
| | | | | | | | | | | | Allows for append operations to avoid breaking inline chain.
* | | Provide stubbed visitor implementationkpdecker2014-11-051-2/+58
| |/ |/| | | Part of #889
* | Add preventIndent option for partialskpdecker2014-11-021-1/+6
| | | | | | | | | | This disables the standalone partial indent behavior required by the Mustache spec and allows for users to utilize partials in the same manner as under 1.x. Fixes #858