mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user