Changeset 22487
- Timestamp:
- 2014-09-29T23:53:59+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Compiler/FrontEnd/Static.mo
r22436 r22487 718 718 719 719 // homotopy replacement (usually used for debugging only) 720 case (cache,env,Absyn.CALL(function_ = Absyn.CREF_IDENT("homotopy", _),functionArgs = Absyn.FUNCTIONARGS(args = args,argNames = _)),impl,st,doVect,pre,_,_)720 case (cache,env,Absyn.CALL(function_ = Absyn.CREF_IDENT("homotopy", _),functionArgs = Absyn.FUNCTIONARGS(args = args,argNames = nargs)),impl,st,doVect,pre,_,_) 721 721 equation 722 722 replaceWith = Flags.getConfigString(Flags.REPLACE_HOMOTOPY); … … 725 725 true = boolOr(stringEq(replaceWith, "actual"), stringEq(replaceWith, "simplified")); 726 726 // TODO, handle empy args and nargs for homotopy! 727 {e1, e2} = args;727 {e1, e2} = getHomotopyArguments(args, nargs); 728 728 e = Util.if_(stringEq(replaceWith, "actual"), e1, e2); 729 729 (cache,e_1,prop,st_1) = elabExpInExpression(cache, env, e, impl, st, doVect, pre, info); … … 899 899 end matchcontinue; 900 900 end elabExp2; 901 902 public function getHomotopyArguments 903 input list<Absyn.Exp> args; 904 input list<Absyn.NamedArg> nargs; 905 output list<Absyn.Exp> outPositionalArgs; 906 algorithm 907 outPositionalArgs := matchcontinue(args, nargs) 908 local 909 Absyn.Exp e1, e2; 910 911 // only positional 912 case ({e1, e2}, _) then {e1, e2}; 913 // only named 914 case ({}, {Absyn.NAMEDARG("actual", e1), Absyn.NAMEDARG("simplified", e2)}) then {e1, e2}; 915 case ({}, {Absyn.NAMEDARG("simplified", e2), Absyn.NAMEDARG("actual", e1)}) then {e1, e2}; 916 // combination 917 case ({e1}, {Absyn.NAMEDARG("simplified", e2)}) then {e1, e2}; 918 case (_, _) 919 equation 920 Error.addCompilerError("+replaceHomotopy: homotopy called with wrong arguments: " +& 921 Dump.printFunctionArgsStr(Absyn.FUNCTIONARGS(args, nargs))); 922 then 923 fail(); 924 end matchcontinue; 925 end getHomotopyArguments; 901 926 902 927 protected function elabIfExp
Note: See TracChangeset
for help on using the changeset viewer.