prevent nested templatePlugin from overwriting parent instance - #19
Open
themightychris wants to merge 3 commits into
Open
prevent nested templatePlugin from overwriting parent instance#19themightychris wants to merge 3 commits into
themightychris wants to merge 3 commits into
Conversation
Owner
|
IIRC the UUID is to make sure that two templates defined in two different places get different names even though they can be declared using the same name. Your patch might fix this but could break the case where you have test.sub1.tpl and test.sub1bis.tpl both defining a sub1 template. Not sure if that was working at all though. I haven't touched this code in many years so this is not guaranteed to be accurate :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@Seldaek I know dwoo1 is end-of-life, but dwoo2 isn't suitable for me yet. I expect you won't want to merge any more pull requests but if you could comment on this a bit it would be very helpful as I wasn't able to discern the original intention behind appending templatePlugin function names with _$uuid
Scenario
test.tpl:
test.sub1.tpl:
test.sub2.tpl:
Problem
The above example fails on test.tpl's call to
{sub1}withFatal error: Call to undefined function Dwoo_Plugin_sub1_535188f29fcdb()because{load_templates test.sub2.tpl}copies an instance of{sub1}with a different UUID from the cloned compiler back to the original compiler, causing the function written to the compiled template to use the UUID generated within test.sub2.tplSolution
The best solution I could find was to remove the _$uuid suffix from generated templatePlugin functions and prevent Compiler->addTemplatePlugin from overwriting an existing templatePlugin entry with one with a new UUID. Indexing template plugins by only their name in the templatePlugins array implies the names should be globally unique, so I couldn't make sense of why the function name needed to have the UUID appended. I kept the UUID logic in place for generating the scope though.
Unanswered Question