mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Optimize default arguments (@ operator) into script rules.
The plan is to deprecate rule form completely, so instead of replace_rule(match:..) write replace_text@(match: ...) git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@987 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -611,9 +611,18 @@ ScriptValueP match_rule(Context& ctx) {
|
||||
SCRIPT_FUNCTION(match_rule) {
|
||||
return match_rule(ctx);
|
||||
}
|
||||
SCRIPT_FUNCTION(match) {
|
||||
SCRIPT_FUNCTION_WITH_SIMPLIFY(match) {
|
||||
return match_rule(ctx)->eval(ctx);
|
||||
}
|
||||
SCRIPT_FUNCTION_SIMPLIFY_CLOSURE(match) {
|
||||
ScriptValueP match = closure.getBinding(SCRIPT_VAR_match);
|
||||
if (match) {
|
||||
intrusive_ptr<ScriptMatchRule> ret(new ScriptMatchRule);
|
||||
from_script(match, ret->regex);
|
||||
return ret;
|
||||
}
|
||||
return ScriptValueP();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Rules : sort text
|
||||
|
||||
|
||||
Reference in New Issue
Block a user