make uninitialized global and local variables cause exception.
This commit is contained in:
parent
90540d3c44
commit
f3b66d9770
@ -81,6 +81,8 @@ namespace jet {
|
||||
renderVariableName(variable, name, modifier, lvariables);
|
||||
name.split(".");
|
||||
if(name.getList().size() == 1) {
|
||||
if(variables.find(name[0]) == variables.end())
|
||||
throw coreutils::Exception("global variable is not initialized.");
|
||||
return processModifier(variables[name[0]], modifier);
|
||||
}
|
||||
return getSessionVariable(name);
|
||||
@ -90,6 +92,8 @@ namespace jet {
|
||||
coreutils::MString name;
|
||||
coreutils::MString modifier;
|
||||
renderVariableName(variable, name, modifier, lvariables);
|
||||
if(lvariables.find(name) == lvariables.end())
|
||||
throw coreutils::Exception("local variable is not initialized.");
|
||||
return lvariables[name];
|
||||
}
|
||||
throw coreutils::Exception("Expecting a variable initializer ('$[' or '#[').");
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/home/barant/Development/JetCore/jet-2.0
|
||||
#!../jet-2.0
|
||||
<jet cgi="true" name1="localname" filterblanklines="true" trimlines="true">
|
||||
<header name="Content-Type" value="text/html" />
|
||||
<comment>This is a comment and should not show up in the output.</comment>
|
||||
|
@ -19,4 +19,5 @@ $[var$[i$[letterx]]$[i$[letterx]]]
|
||||
$[ix]
|
||||
<set name="ix" expr="$[ix]+1" />
|
||||
$[ix]
|
||||
#[iy]
|
||||
</jet>
|
||||
|
Loading…
x
Reference in New Issue
Block a user