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