Skip to content

Commit

Permalink
- handle some of the builtin functions
Browse files Browse the repository at this point in the history
- handle records 
- add a Compiler/FrontEnd/TypeCheck.mo for type checking (does nothing for now, more will come later).


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@12239 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Jun 29, 2012
1 parent f59164e commit 8be4c2a
Show file tree
Hide file tree
Showing 5 changed files with 398 additions and 29 deletions.
8 changes: 8 additions & 0 deletions Compiler/FrontEnd/InstTypes.mo
Expand Up @@ -78,13 +78,21 @@ public uniontype Class
end Class;

public uniontype Function

record FUNCTION "A function has inputs,output and locals without binding. These are resolved to statements in the algorithm section"
Absyn.Path path;
list<Element> inputs;
list<Element> outputs;
list<Element> locals;
list<Statement> algorithms "TODO: Add default bindings";
end FUNCTION;

record RECORD "A record has locals with bindings"
Absyn.Path path;
list<Element> components;
list<Statement> algorithms "TODO: Add default bindings";
end RECORD;

end Function;

public uniontype Dimension
Expand Down
12 changes: 12 additions & 0 deletions Compiler/FrontEnd/SCode.mo
Expand Up @@ -917,6 +917,18 @@ algorithm
end matchcontinue;
end componentNamesFromElts;

public function isRecord
"function: isRecord
Return true if Class is a record."
input Element inClass;
output Boolean outBoolean;
algorithm
outBoolean := matchcontinue (inClass)
case CLASS(restriction = R_RECORD()) then true;
case _ then false;
end matchcontinue;
end isRecord;

public function isFunction
"function: isFunction
Return true if Class is a function."
Expand Down

0 comments on commit 8be4c2a

Please sign in to comment.