diff options
author | mihaylov <mihaylov@epfl.ch> | 2004-06-08 08:36:29 +0000 |
---|---|---|
committer | mihaylov <mihaylov@epfl.ch> | 2004-06-08 08:36:29 +0000 |
commit | 794a8601bf92ae031f6c9d56826971fe109ea37a (patch) | |
tree | 1ccccde43122fdf90657009d776d913b520f108a /sources/scalac | |
parent | 706cd4cf87157ccb6863811edae5a374bf2a3a03 (diff) | |
download | scala-794a8601bf92ae031f6c9d56826971fe109ea37a.tar.gz scala-794a8601bf92ae031f6c9d56826971fe109ea37a.tar.bz2 scala-794a8601bf92ae031f6c9d56826971fe109ea37a.zip |
- Fixed a bug in determining the name of the ge...
- Fixed a bug in determining the name of the generated assembly when no
entry point is present in the source program
Diffstat (limited to 'sources/scalac')
-rw-r--r-- | sources/scalac/backend/msil/TypeCreator.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sources/scalac/backend/msil/TypeCreator.java b/sources/scalac/backend/msil/TypeCreator.java index 7916a247ae..7242c7ad17 100644 --- a/sources/scalac/backend/msil/TypeCreator.java +++ b/sources/scalac/backend/msil/TypeCreator.java @@ -442,9 +442,9 @@ final class TypeCreator { return moreThanOneEntryPoint; } - private SourceFile mainSourceFile; + private Unit entryPointUnit; - private int mainLineNum; + private int entryPointPos; /** - collects the symbols of all classes defined in the program * - collects all entry points @@ -463,7 +463,7 @@ final class TypeCreator { // source file if not supplied with the -o option assemName = aname; if (assemName == null) { - assemName = mainSourceFile.getFile().getName(); + assemName = entryPointUnit.source.getFile().getName(); assert assemName.endsWith(".scala") : assemName; assemName = assemName.substring(0, assemName.length() - 6); } @@ -494,6 +494,8 @@ final class TypeCreator { private Unit currUnit; public void traverse(Unit unit) { currUnit = unit; + if (entryPointUnit == null) + entryPointUnit = unit; super.traverse(unit); } public void traverse(Tree tree) { @@ -507,8 +509,8 @@ final class TypeCreator { if (isEntryPoint(sym)) { if (entryPoint == null) { entryPoint = sym; - mainSourceFile = currUnit.source; - mainLineNum = Position.line(tree.pos); + entryPointUnit = currUnit; + entryPointPos = tree.pos; } else moreThanOneEntryPoint = true; } @@ -562,8 +564,8 @@ final class TypeCreator { ILGenerator code = main.GetILGenerator(); if (global.args.debuginfo.value) { String fname = SourceRepresentation - .escape(mainSourceFile.getFile().getPath()); - code.setPosition(mainLineNum, fname); + .escape(entryPointUnit.source.getFile().getPath()); + code.setPosition(Position.line(entryPointPos), fname); } code.Emit(OpCodes.Ldsfld, moduleField); |