diff --git a/Global.cpp b/Global.cpp index d7c7ca7..6ff9d23 100644 --- a/Global.cpp +++ b/Global.cpp @@ -80,7 +80,9 @@ namespace jet { } else { renderVariableName(variable, name, modifier, lvariables); 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 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 '#[')."); diff --git a/tests/testjet.jet b/tests/testjet.jet index 7cdd5a6..eb588f6 100755 --- a/tests/testjet.jet +++ b/tests/testjet.jet @@ -1,4 +1,4 @@ -#!/home/barant/Development/JetCore/jet-2.0 +#!../jet-2.0
This is a comment and should not show up in the output. diff --git a/tests/testvar.jet b/tests/testvar.jet index 3c79fed..591b836 100755 --- a/tests/testvar.jet +++ b/tests/testvar.jet @@ -19,4 +19,5 @@ $[var$[i$[letterx]]$[i$[letterx]]] $[ix] $[ix] +#[iy]