Closure operator now behaves as default argument operator, documentation.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@965 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-06-03 18:33:17 +00:00
parent c5159ebcf7
commit d00beeb55f
11 changed files with 182 additions and 60 deletions
+4 -4
View File
@@ -177,20 +177,20 @@ void KeywordReminderTextValue::highlight(const String& code, const vector<Script
}
bool KeywordReminderTextValue::checkScript(const ScriptP& script) {
Context& ctx = set.cards.empty() ? set.getContext() : set.getContext(set.cards.front());
size_t scope = ctx.openScope();
try {
Context& ctx = set.cards.empty() ? set.getContext() : set.getContext(set.cards.front());
LocalScope scope(ctx);
for (size_t i = 0 ; i < keyword.parameters.size() ; ++i) {
String param = String(_("param")) << (int)(i+1);
ctx.setVariable(param, to_script(param));
}
script->eval(ctx);
errors.clear();
return true;
} catch (const Error& e) {
errors = e.what();
return false;
}
ctx.closeScope(scope);
return errors.empty();
}
// ----------------------------------------------------------------------------- : Changing keywords : mode