Skip to content

Commit

Permalink
- Merged the cases in SCodeInst.instFunctionCall, since RML unifies them
Browse files Browse the repository at this point in the history
  incorrectly.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@12451 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed Aug 8, 2012
1 parent 3ec0588 commit 637c114
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
23 changes: 23 additions & 0 deletions Compiler/FrontEnd/InstUtil.mo
Expand Up @@ -66,6 +66,7 @@ public type Dimension = InstTypes.Dimension;
public type Element = InstTypes.Element;
public type Env = SCodeEnv.Env;
public type Equation = InstTypes.Equation;
public type Function = InstTypes.Function;
public type Modifier = InstTypes.Modifier;
public type ParamType = InstTypes.ParamType;
public type Prefixes = InstTypes.Prefixes;
Expand Down Expand Up @@ -133,6 +134,13 @@ algorithm
case (InstTypes.EXTENDED_ELEMENTS(cls = cls), vars)
then makeDaeVarsFromClass(cls, vars);

case (InstTypes.CONDITIONAL_ELEMENT(component = comp), vars)
equation
var = componentToDaeVar(comp);
vars = var :: vars;
then
vars;

end match;
end makeDaeVarsFromElement;

Expand Down Expand Up @@ -175,6 +183,7 @@ algorithm
then
DAE.TYPES_VAR(name, DAE.dummyAttrVar, ty, DAE.UNBOUND(), NONE());

// TODO: Handle stuff like conditional components here.
else DAE.TYPES_VAR("dummy", DAE.dummyAttrVar, DAE.T_UNKNOWN_DEFAULT,
DAE.UNBOUND(), NONE());

Expand Down Expand Up @@ -1580,4 +1589,18 @@ algorithm
end match;
end isFlowComponent;

public function getFunctionInputs
input Function inFunction;
output list<Element> outInputs;
algorithm
outInputs := match(inFunction)
local
list<Element> inputs;

case InstTypes.FUNCTION(inputs = inputs) then inputs;
case InstTypes.RECORD(components = inputs) then inputs;

end match;
end getFunctionInputs;

end InstUtil;
19 changes: 4 additions & 15 deletions Compiler/FrontEnd/SCodeInst.mo
Expand Up @@ -2012,33 +2012,22 @@ algorithm
(outCallExp,outFunctions) := matchcontinue(inName, inPositionalArgs, inNamedArgs, inEnv, inPrefix, inInfo, inFunctions)
local
Absyn.Path call_path;
DAE.ComponentRef cref;
list<DAE.Exp> pos_args, args;
list<tuple<String, DAE.Exp>> named_args;
Class func;
list<Element> inputs,outputs;
Function func;
list<Element> inputs;
FunctionHashTable functions;

// inst records
case (_, _, _, _, _, _, functions)
equation
(call_path, InstTypes.RECORD(components=inputs), functions) = instFunction(inName, inEnv, inPrefix, inInfo, functions);
(call_path, func, functions) = instFunction(inName, inEnv, inPrefix, inInfo, functions);
(pos_args,functions) = instExpList(inPositionalArgs, inEnv, inPrefix, inInfo, functions);
(named_args,functions) = List.map3Fold(inNamedArgs, instNamedArg, inEnv, inPrefix, inInfo, functions);
inputs = InstUtil.getFunctionInputs(func);
args = fillFunctionSlots(pos_args, named_args, inputs, call_path, inInfo);
then
(DAE.CALL(call_path, args, DAE.callAttrBuiltinOther),functions);

// inst functions
case (_, _, _, _, _, _, functions)
equation
(call_path, InstTypes.FUNCTION(inputs=inputs,outputs=outputs), functions) = instFunction(inName, inEnv, inPrefix, inInfo, functions);
(pos_args,functions) = instExpList(inPositionalArgs, inEnv, inPrefix, inInfo, functions);
(named_args,functions) = List.map3Fold(inNamedArgs, instNamedArg, inEnv, inPrefix, inInfo, functions);
args = fillFunctionSlots(pos_args, named_args, inputs, call_path, inInfo);
then
(DAE.CALL(call_path, args, DAE.callAttrBuiltinOther),functions);

end matchcontinue;
end instFunctionCall;

Expand Down

0 comments on commit 637c114

Please sign in to comment.