Skip to content

Commit

Permalink
Susan: Do not assign the same variable twice
Browse files Browse the repository at this point in the history
Earlier, Susan would assign to the same variable twice when calling
a template that takes two Text arguments and was passed the same
variable name for both of them. Now, the last argument is used in the
assignment.

Clean templates at stage 3 bootstrapping in order to get the latest
version of Susan-generated code.
  • Loading branch information
sjoelund committed Feb 24, 2016
1 parent f13e19f commit fa412ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Compiler/Template/TplAbsyn.mo
Expand Up @@ -2519,6 +2519,7 @@ algorithm
list<MMExp> mmargs;
list<Ident> lhsArgs;
TemplPackage tplPackage;
MMExp exp;

case ( _, _, {}, _)
then
Expand All @@ -2535,10 +2536,11 @@ algorithm
//a text argument that is input and output
//an actual parameter ident ... non-internal idents all starts with "_"
//- put it out
case ( MM_IDENT(IDENT(txtarg)) :: mmargs, _ :: iargs, _ :: oargs, tplPackage)
case ((exp as MM_IDENT(IDENT(txtarg))) :: mmargs, _ :: iargs, _ :: oargs, tplPackage)
equation
// obsolete ... "_" = stringGetStringChar(txtarg, 1);
//areEqualInOutArgs(iarg , oarg);
false = listMember(exp, mmargs); // This makes only the last Text argument be cached, but it is the simplest solution
lhsArgs = elabOutTextArgs(mmargs, iargs, oargs, tplPackage);
then
( txtarg :: lhsArgs );
Expand Down
1 change: 1 addition & 0 deletions Compiler/boot/Makefile.common
Expand Up @@ -68,6 +68,7 @@ bootstrap-from-tarball: $(PATCHES)
$(MAKE) -f $(defaultMakefileTarget) install INCLUDESOURCES=1 OMC=$(BOOTSTRAP_OMC)
@echo "Bootstrapping phase 2/3 completed"
$(MAKE) -f $(defaultMakefileTarget) clean OMC=$(BOOTSTRAP_OMC)
$(MAKE) -f $(defaultMakefileTarget) --no-print-directory -C $(TOP_DIR)/Compiler/Template OMC=$(BOOTSTRAP_OMC) clean
$(MAKE) -f $(defaultMakefileTarget) --no-print-directory -C $(TOP_DIR)/Compiler/Script OMC=$(BOOTSTRAP_OMC) clean
$(MAKE) -f $(defaultMakefileTarget) generate-files-in-steps OMC=$(BOOTSTRAP_OMC)
$(MAKE) -f $(defaultMakefileTarget) install INCLUDESOURCES=1 OMC=$(BOOTSTRAP_OMC)
Expand Down

0 comments on commit fa412ec

Please sign in to comment.