From: dpvc v. a. <we...@ma...> - 2009-09-16 11:15:38
|
Log Message: ----------- Fix context() method to SET the context when one is passed Modified Files: -------------- pg/lib: Parser.pm Revision Data ------------- Index: Parser.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser.pm,v retrieving revision 1.53 retrieving revision 1.54 diff -Llib/Parser.pm -Llib/Parser.pm -u -r1.53 -r1.54 --- lib/Parser.pm +++ lib/Parser.pm @@ -56,8 +56,14 @@ # Get the object's context, or the default one # sub context { - my $self = shift; - return $self->{context} if Value::isHash($self) && $self->{context}; + my $self = shift; my $context = shift; + if (Value::isHash($self)) { + if ($context && $self->{context} != $context) { + $self->{context} = $context; + $self->{tree} = $self->{tree}->copy($self) if $self->{tree}; + } + return $self->{context} if $self->{context}; + } Parser::Context->current; } |