Fix for #11, bug in mixin injection with blocks #12

merged 2 commits into from Jul 17, 2012


None yet

2 participants


This is a fix for #11 which fixes mixin injection with blocks by implementing deep cloning of the mixin upon reference.

A test case from visionmedia/jade tests cases is included, but results must be checked manually similar to other tests.

As a side note, the cloning operation should really occur at template compilation time, and not during template evaluation for better performance and memory management.

@gscottrw gscottrw Fix for duplicated block in mixin injection
The first use of a mixin injection with a block would reuse block on
all future mixin injections.  Implemented deep cloning of mixin to
prevent template corruption.

You are correct - object creation defentitly should be done in the parsing phase! Can you try to move it?

Can you provide a test this feature in our CompilerTest? Ive copied over the 'original tests' mainly for reference when we were almost done with our first release.

The files the CompilerTest uses live under test/resources/compiler.

@gscottrw gscottrw Added test case mixin_blocks
Test case is a copy of mixin.blocks test case from visionmedia/jade

@naltatis I've added the test case for mixin_blocks in +CompilerTest+. This is the same test case as before from visionmedia/jade.

I'll take a look at the optimization, but as part of another pull request. I'm doing some profiling on jade4j and there are a number of places that could be optimized including pre-parsing OGNL expressions, etc. I'm actually more interested in implementing byte code generation using Eclipse JDT, as I would like to use jade4j in production environments where performance could be an issue.

@naltatis naltatis merged commit 8e961ef into neuland:master Jul 17, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment