Opened 9 years ago
Closed 5 years ago
#3417 closed defect (invalid)
Create API updateClass for merging parsed AST with existing AST
Reported by: | adrpo | Owned by: | adrpo |
---|---|---|---|
Priority: | blocker | Milestone: | 1.14.0 |
Component: | Interactive Environment | Version: | trunk |
Keywords: | Cc: | adeas31 |
Description
When supporting #2905 we need to reload packages (package.mo) which would make the contents of the package vanish if we do not merge parsed AST with the existing AST.
Change History (10)
comment:1 Changed 9 years ago by sjoelund.se
comment:2 Changed 9 years ago by adrpo
- Cc adeas31 added
I guess it would be something like parseFileAndMerge(file) which will take the AST of the file and merge it with the existing AST (already loaded ones). If the class parsed already exists in the loaded AST then the contents will be merged, not replaced.
So if you have A.B.C loaded and you reload B then C will still be in the AST.
comment:3 Changed 9 years ago by casella
- Milestone changed from Future to 1.9.4
- Owner changed from somebody to adrpo
- Priority changed from high to blocker
- Status changed from new to assigned
comment:4 Changed 9 years ago by adrpo
- Status changed from assigned to accepted
Added support for this in 45515a6/OMCompiler.
Added test in 3539b9b/OpenModelica-testsuite.
Adapted OMEdit OMCProxy.cpp in b1c9a9e/OMEdit.
@adeas31, can you give it a try and see if it works fine?
Basically we have a new input for loadString(merge=false) which will merge the AST if merge=true, not replace it. Default merge=false.
comment:5 Changed 9 years ago by adrpo
- Resolution set to fixed
- Status changed from accepted to closed
comment:6 Changed 8 years ago by sjoelund.se
- Milestone changed from 1.9.4 to 1.9.4-1.9.x
Milestone renamed
comment:7 Changed 8 years ago by sjoelund.se
- Milestone changed from 1.9.4-1.9.x to 1.9.4
Milestone renamed
comment:8 Changed 5 years ago by adrpo
- Milestone changed from 1.9.4 to 1.14.0
- Resolution fixed deleted
- Status changed from closed to reopened
New issue shows up:
loadString("package P model M end M; end P;"); getErrorString(); getClassNames(P); getErrorString(); loadString("package P annotation(); end P;", merge=true); getErrorString(); getClassNames(P); getErrorString();
running this script looses model M :)
comment:9 Changed 5 years ago by adrpo
- Status changed from reopened to accepted
comment:10 Changed 5 years ago by adrpo
- Resolution set to invalid
- Status changed from accepted to closed
What it does is actually correct, it replaces the contents of the file containing P with the contents of the new file containing P. If M would have been loaded from another file than P then it would have been kept.
How is this something needed by #2905? Please provide an example of what the API needs to look like.