summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler
Commit message (Collapse)AuthorAgeFilesLines
* 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
* | Allow whitespace control on commentskpdecker2014-11-022-4/+8
|/ | | | | This changes the call signature for the CommentNode constructor, which is a potentially breaking change for AST users. Fixes #866
* Render false literal as “false”kpdecker2014-08-251-1/+1
| | | Fixes #827
* Prune unused codekpdecker2014-08-253-4/+2
|
* Refactor content blocks to ignore lineskpdecker2014-08-251-57/+31
| | | | | We can simplify our previous standalone determination logic by merging content blocks again. Fixes #854
* Allow passing depths to _childkpdecker2014-08-251-2/+2
|
* Optimize compiler opcode callkpdecker2014-08-241-1/+3
|
* Additional test coverage cleanupkpdecker2014-08-231-4/+2
| | | Also fixes the template._child implementation which broke with the depthed work.
* Restore helperMissing for ambiguous statementskpdecker2014-08-231-1/+2
| | | | Fixes #318 (regression) Partial fix for #783
* Cleanup from code coverage reportkpdecker2014-08-232-13/+9
|
* Move strip processing into AST helper logickpdecker2014-08-233-53/+67
| | | | | We already have to track these behaviors for the standalone parsing and rather than having two whitespace pruning implementations this moves all of the behavior into one place. Fixes #852
* Replace string value rather than add omit flagkpdecker2014-08-232-3/+4
|
* Add original value tracking to ContentNodekpdecker2014-08-231-1/+1
|
* Merge branch 'refactor-parser' of github.com:mmun/handlebars.js into ↵kpdecker2014-08-233-174/+177
|\ | | | | | | | | | | | | | | | | mmun-refactor-parser Conflicts: lib/handlebars/compiler/ast.js spec/ast.js src/handlebars.yy
| * Refactor blocks, programs and inversesMartin Muñoz2014-07-293-46/+56
| |
* | Optimize replaceStack for inline methodskpdecker2014-08-231-40/+24
| | | | | | Only use case was with inline input so most of this code was unnecessary.
* | Remove unnecessary stack variable from blockHelperkpdecker2014-08-231-4/+4
| |
* | Do not flush subexpressionskpdecker2014-08-231-7/+0
| | | | | | | | | | | | They are no longer duplicated with the new helper calling pattern and this also introduced stack corruption issues due to improper value lookups. Fixes #767 Fixes #768
* | Fix undefined handling for pathed lookupskpdecker2014-08-151-4/+3
| | | | | | | | Fixes #837
* | Strip dead code from javascript compilerkpdecker2014-08-151-9/+2
| |
* | Fix compat partial exec without datakpdecker2014-08-151-0/+2
| |
* | Make depthed lookup call non-literalkpdecker2014-08-151-1/+1
| | | | | | Prevents duplicate calls from being made.
* | Fix compiler program de-dupingkpdecker2014-08-141-9/+19
| |
* | Drop unused Compiler.disassemble methodkpdecker2014-08-141-24/+0
| |
* | Drop unused DECLARE opcodekpdecker2014-08-142-9/+1
| |
* | Increase test coverage a touchkpdecker2014-08-141-4/+2
| |
* | Implement partial recursive lookupkpdecker2014-08-141-1/+4
| |
* | Inherit compat flag for partialskpdecker2014-08-141-1/+4
| |
* | Implement recursive field lookup in compat modekpdecker2014-08-132-8/+24
| | | | | | | | | | | | Provides the mustache behavior of recursive lookup without the use of depthed paths. Note that this does incur a fairly dramatic performance penalty for depthed queries.
* | Use depths array rather than passing array argskpdecker2014-08-131-9/+20
| | | | | | Approximately doubles the throughput performance of depthed templates and clears the way for doing recursive path lookups in pathed mode.
* | Create contextName helper for context lookupkpdecker2014-08-132-8/+12
| |