Skip to content

Commit

Permalink
- 5th version of the SCodeInstShortcut.mo (+d=scodeInstShortcut)
Browse files Browse the repository at this point in the history
Absyn.mo
- Absyn.pathSetLastIdent
- when +d=scodeInstShortcut the last id of the path might be different
  don't check for it in Absyn.typeSpecEqual

Ceval.mo
- remove the no constant binding error messages

InstUtil.mo
- InstUtil.prefixToStr/prefixToStrNoEmpty/prefixFirstName

SCode.mo
- plenty of new functions to set/get stuff

SCodeAnalyseRedeclare.mo
- new package to do a dryrun of scode inst and analyse redeclares

SCodeApplyRedeclare.mo
- apply the stuff from the redeclare analysis to the SCode AST.

SCodeDependency.mo
- changes due to interface changes in other packages.

SCodeDump.mo
- better display in SCodeDump.shortElementStr

SCodeEnv.mo
- changes to item printing
- return the applied redeclares in some functions
- SCodeEnv.getDerivedClassRedeclares to get redeclares to be applied for SCode.DERIVED
- SCodeEnv.mergeTypeSpecWithEnvPath same as for SCodeEnv.mergePathWithEnvPath but for TypeSpec

SCodeFlattenRedeclare.mo
- union Replacement for storing the redeclares
- replaceRedeclaredElementInEnv now always pushes redeclares to baseclasses

SCodeInst.mo
- apply redeclares for SCode.DERIVED too
- small changes due to interface changes in other packages

SCodeInstShortcut.mo
- call SCodeAnalyseRedeclare then SCodeApplyRedeclare

SCodeLookup.mo
- return Absyn.TypeSpec when doing SCodeLookup.lookupTypeSpec

SCodeMod.mo
- changes to how applyModifications and updateModElement
  handle multiple base classes

Static.mo
- remove the no constant binding error messages

CevalScript.mo
- better errors for buildOpenTURNSInterface
- a bit different handling for +d=scodeInstShortcut in runFrontEndWork

Flags.mo
- new flags +d=showRedeclareAnalysis,showProgramChanges to be used for
  debugging of +d=SCodeInstShortcut

- test updates (i guess more will fail, I'll update them next after Hudson tells)


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13930 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Nov 16, 2012
1 parent 63fda3a commit 68b26b7
Show file tree
Hide file tree
Showing 19 changed files with 4,398 additions and 305 deletions.
37 changes: 37 additions & 0 deletions Compiler/FrontEnd/Absyn.mo
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ encapsulated package Absyn
protected import Debug;
protected import Dump;
protected import System;
protected import Flags;

public
type Ident = String "An identifier, for example a variable name" ;
Expand Down Expand Up @@ -2639,6 +2640,15 @@ algorithm
Path p1,p2;
Option<ArrayDim> oad1,oad2;
list<TypeSpec> lst1,lst2;
case(TPATH(p1,oad1), TPATH(p2,oad2))
equation
true = Flags.isSet(Flags.SCODE_INST_SHORTCUT);
p1 = stripLast(p1);
p2 = stripLast(p2);
true = pathEqual(p1,p2);
true = optArrayDimEqual(oad1,oad2);
then
true;
case(TPATH(p1,oad1), TPATH(p2,oad2))
equation
true = pathEqual(p1,p2);
Expand Down Expand Up @@ -5745,4 +5755,31 @@ algorithm
COMPONENTITEM(component=COMPONENT(name=name)) := c;
end componentName;

public function pathSetLastIdent
input Path inPath;
input Path inLastIdent;
output Path outPath;
algorithm
outPath := matchcontinue(inPath, inLastIdent)
local
Path p;
String n;

case (IDENT(_), _) then inLastIdent;

case (QUALIFIED(n, p), _)
equation
p = pathSetLastIdent(p, inLastIdent);
then
QUALIFIED(n, p);

case (FULLYQUALIFIED(p), _)
equation
p = pathSetLastIdent(p, inLastIdent);
then
FULLYQUALIFIED(p);

end matchcontinue;
end pathSetLastIdent;

end Absyn;
2 changes: 1 addition & 1 deletion Compiler/FrontEnd/Ceval.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4723,7 +4723,7 @@ algorithm
equation
str = ComponentReference.printComponentRefStr(inCref);
scope_str = Env.printEnvPathStr(inEnv);
Error.addSourceMessage(Error.NO_CONSTANT_BINDING, {str, scope_str}, info);
// Error.addSourceMessage(Error.NO_CONSTANT_BINDING, {str, scope_str}, info);
Debug.fprintln(Flags.CEVAL, "- Ceval.cevalCref on: " +& str +&
" failed with no constant binding in scope: " +& scope_str);
// build a default binding for it!
Expand Down
68 changes: 68 additions & 0 deletions Compiler/FrontEnd/InstUtil.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2028,5 +2028,73 @@ algorithm
end match;
end getClassName;

public function prefixToStr
input Prefix inPrefix;
output String outStr;
algorithm
outStr := match(inPrefix)
local
String name, str;
Prefix rest_prefix;
Absyn.Path path;

case InstTypes.EMPTY_PREFIX(classPath = NONE()) then "E()";

case InstTypes.EMPTY_PREFIX(classPath = SOME(path))
equation
str = "E(" +& Absyn.pathLastIdent(path) +& ")";
then
str;

case InstTypes.PREFIX(name = name, restPrefix = rest_prefix)
equation
str = prefixToStr(rest_prefix) +& "." +& name;
then
str;

end match;
end prefixToStr;

public function prefixToStrNoEmpty
input Prefix inPrefix;
output String outStr;
algorithm
outStr := match(inPrefix)
local
String name, str;
Prefix rest_prefix;
Absyn.Path path;

case InstTypes.EMPTY_PREFIX(classPath = _) then "";

case InstTypes.PREFIX(name = name,
restPrefix = InstTypes.EMPTY_PREFIX(classPath = _))
then
name;

case InstTypes.PREFIX(name = name, restPrefix = rest_prefix)
equation
str = prefixToStrNoEmpty(rest_prefix) +& "." +& name;
then
str;

end match;
end prefixToStrNoEmpty;

public function prefixFirstName
input Prefix inPrefix;
output String outStr;
algorithm
outStr := match(inPrefix)
local
String name, str;
Prefix rest_prefix;
Absyn.Path path;

case InstTypes.EMPTY_PREFIX(classPath = _) then "";
case InstTypes.PREFIX(name = name) then name;

end match;
end prefixFirstName;

end InstUtil;

0 comments on commit 68b26b7

Please sign in to comment.