Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 30c6ba5

Browse files
adeas31OpenModelica-Hudson
authored andcommitted
Return "<interactive>" as file name when duplicating top level class
1 parent e8fc3ef commit 30c6ba5

File tree

1 file changed

+2
-39
lines changed

1 file changed

+2
-39
lines changed

Compiler/Script/CevalScriptBackend.mo

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4249,51 +4249,14 @@ protected function copyClass
42494249
output Absyn.Program outProg;
42504250
protected
42514251
Absyn.Class cls;
4252-
String orig_file, delim, cls_path_str;
4253-
String pkg_path, library_path, dst_path;
4254-
Integer len, delim_len;
4252+
String orig_file, dst_path;
42554253
Absyn.Path cls_path = inClassPath;
42564254
algorithm
42574255
Absyn.CLASS(info = SOURCEINFO(fileName = orig_file)) := inClass;
42584256

42594257
dst_path := match inWithin
42604258
// Destination is top scope, put the copy in a new file.
4261-
case Absyn.TOP()
4262-
algorithm
4263-
len := stringLength(orig_file);
4264-
delim := System.pathDelimiter();
4265-
delim_len := stringLength(delim);
4266-
4267-
// Figure out what the package is called.
4268-
if System.basename(orig_file) == "package.mo" then
4269-
// Get the part before package.mo.
4270-
pkg_path := System.dirname(orig_file);
4271-
else
4272-
// Remove the .mo suffix.
4273-
pkg_path := substring(orig_file, 1, len - 3);
4274-
end if;
4275-
4276-
// Figure out what the base path for the library is.
4277-
len := stringLength(pkg_path);
4278-
while true loop
4279-
cls_path_str := Absyn.pathString(cls_path, delim);
4280-
4281-
// Check if the given class path matches the end of the path.
4282-
if substring(pkg_path, len - stringLength(cls_path_str) + 1, len) == cls_path_str then
4283-
library_path := substring(pkg_path, 1, len - stringLength(cls_path_str) - delim_len);
4284-
break;
4285-
end if;
4286-
4287-
if Absyn.pathIsIdent(cls_path) then
4288-
library_path := pkg_path;
4289-
break;
4290-
end if;
4291-
4292-
// Remove the last part of the class path and try again.
4293-
cls_path := Absyn.stripLast(cls_path);
4294-
end while;
4295-
then
4296-
library_path + delim + inName + ".mo";
4259+
case Absyn.TOP() then "<interactive>";
42974260

42984261
// Destination is within another class, put the copy in the same file as the
42994262
// destination class.

0 commit comments

Comments
 (0)