Skip to content

Commit

Permalink
Some refactoring
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@21731 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Aug 4, 2014
1 parent 03a6c8a commit 41912ee
Showing 1 changed file with 8 additions and 32 deletions.
40 changes: 8 additions & 32 deletions Compiler/FrontEnd/Builtin.mo
Expand Up @@ -524,6 +524,8 @@ protected constant SCode.Element objectiveVarComp =
Absyn.TPATH(Absyn.IDENT("Real"), NONE()), SCode.NOMOD(),
SCode.noComment, NONE(), Absyn.dummyInfo);

protected constant list<SCode.ELement> basicTypes = {clockType, rlType, intType, strType, boolType, enumType, ExternalObjectType, realType, integerType, stringType, booleanType, stateSelectType, uncertaintyType};

public function variableIsBuiltin
"Returns true if cref is a builtin variable.
Currently only 'time' is a builtin variable."
Expand Down Expand Up @@ -577,6 +579,7 @@ algorithm
local
list<Absyn.Class> initialClasses;
SCode.Program initialProgram;
list<SCode.Element> types;

// First look for cached version
case (cache) equation
Expand All @@ -591,23 +594,10 @@ algorithm
(cache, env);

// if no cached version found create initial env.
case (cache) equation
case (cache)
equation
env = Env.openScope(Env.emptyEnv, SCode.NOT_ENCAPSULATED(), NONE(), NONE());
env = Env.extendFrameClasses(env,
{rlType,
intType,
strType,
boolType,
enumType,
ExternalObjectType,
realType,
integerType,
stringType,
booleanType,
clockType,
stateSelectType,
uncertaintyType},
SOME(Env.BASIC_TYPE()));
env = Env.extendFrameClasses(env, basicTypes, SOME(Env.BASIC_TYPE()));

env = Env.extendFrameV(
env,
Expand Down Expand Up @@ -841,6 +831,7 @@ algorithm
local
list<Absyn.Class> initialClasses;
SCode.Program initialProgram;
list<SCode.Element> types;

/*/ First look for cached version
case (cache) equation
Expand All @@ -858,22 +849,7 @@ algorithm
case (cache)
equation
graph = FGraph.new(FCore.dummyTopModel);
graph = FGraphBuild.mkProgramGraph(
{rlType,
intType,
strType,
boolType,
enumType,
ExternalObjectType,
realType,
integerType,
stringType,
booleanType,
clockType,
stateSelectType,
uncertaintyType},
FCore.BASIC_TYPE(),
graph);
graph = FGraphBuild.mkProgramGraph(basicTypes, FCore.BASIC_TYPE(), graph);


graph = FGraphBuild.mkCompNode(timeComp, FGraph.top(graph), FCore.BUILTIN(), graph);
Expand Down

0 comments on commit 41912ee

Please sign in to comment.