From: dpvc v. a. <we...@ma...> - 2009-10-03 16:56:43
|
Log Message: ----------- Handle variables in formula 'constants' properly Modified Files: -------------- pg/lib/Parser: Constant.pm Revision Data ------------- Index: Constant.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser/Constant.pm,v retrieving revision 1.16 retrieving revision 1.17 diff -Llib/Parser/Constant.pm -Llib/Parser/Constant.pm -u -r1.16 -r1.17 --- lib/Parser/Constant.pm +++ lib/Parser/Constant.pm @@ -25,6 +25,8 @@ }, $class; $c->weaken; $c->{isConstant} = 1 if $const->{isConstant}; + $equation->{variables} = {%{$equation->{variables}},%{$const->{value}{variables}}} + if Value::isFormula($const->{value}); return $c; } @@ -60,6 +62,15 @@ } # +# Include variables from constant formulas +# +sub getVariables { + my $self = shift; my $data = $self->{def}{value}; + return {} unless Value::isFormula($data); + return $data->{tree}->getVariables; +} + +# # Return the constant's name # sub string { |