merged branch Seldaek/globals_fix (PR #600)
authorFabien Potencier <fabien.potencier@gmail.com>
Tue, 17 Jan 2012 06:17:24 +0000 (07:17 +0100)
committerFabien Potencier <fabien.potencier@gmail.com>
Tue, 17 Jan 2012 06:17:24 +0000 (07:17 +0100)
commit3fbe8d8c469d8db70e6232f8c740130e5d07f4a1
tree8de4227f29f95a75d9ecf4adf2776ccd6d05d2d4
parentf5f1485ef29e326ebf36aecda898f9964c4aebe7
parent43ebae14ff1ccadf9e236a5e6ea4a41c463be564
merged branch Seldaek/globals_fix (PR #600)

Commits
-------

43ebae1 Reset parsers, visitors, filters, tests, functions when a new one or new extension is added
3db62da Reset globals when a new global is added

Discussion
----------

Reset globals when a new global is added

if getGlobals() is called before adding a new global, it is never taken into account

---------------------------------------------------------------------------

by fabpot at 2012-01-16T14:27:02Z

Is it related to #594?

---------------------------------------------------------------------------

by Seldaek at 2012-01-16T14:30:08Z

Seems like it yes. It means that reading globals + writing + reading again will call getGlobals on all extensions again though.

A slight improvement would be to cache the extension globals in another var that can be re-applied at once over the staged globals.

The fastest would be to just set directly in ->globals if it's already initalized, but that means addGlobal can override extension globals. Not sure if that is a problem, but it creates a somewhat non-deterministic factor.

I can adjust as required.

---------------------------------------------------------------------------

by stof at 2012-01-16T14:45:49Z

@Seldaek shouldn't the same be done for other methods (filters, functions, tags, tests and operators) ?

---------------------------------------------------------------------------

by Seldaek at 2012-01-16T14:53:28Z

Indeed, I was just focused on my crazy issue here :) Once @fabpot decides which way he prefers I can apply it to everything.

---------------------------------------------------------------------------

by fabpot at 2012-01-16T21:05:19Z

+1 for the the approach in this PR. @Seldaek: Can you apply it to everything else as well? Thanks.

---------------------------------------------------------------------------

by Seldaek at 2012-01-17T00:54:08Z

Done, also did it for adding and removing extensions since they potentially override stuff.