From 4c83b5e7d2779de15d5ec6deb8105d499d2e3f6f Mon Sep 17 00:00:00 2001 From: mihaylov Date: Mon, 3 Oct 2005 22:11:01 +0000 Subject: Improved handling of the scala.dll assembly --- sources/scalac/symtab/classfile/CLRTypes.java | 28 ++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'sources/scalac') diff --git a/sources/scalac/symtab/classfile/CLRTypes.java b/sources/scalac/symtab/classfile/CLRTypes.java index d14ba470ed..3ce4d8ceba 100644 --- a/sources/scalac/symtab/classfile/CLRTypes.java +++ b/sources/scalac/symtab/classfile/CLRTypes.java @@ -92,13 +92,15 @@ public final class CLRTypes { this.args = args; scala.tools.util.ClassPath.addFilesInPath( assemrefs, args.assemrefs.value); - Assembly mscorlib = findAssembly("mscorlib.dll"); + Assembly mscorlib = findAssembly("mscorlib.dll", true); Type.initMSCORLIB(mscorlib); - findAssembly("vjscor.dll"); - findAssembly("vjslib.dll"); - findAssembly("scala.dll"); + findAssembly("scala.dll", false); findAllAssemblies(); + if (getType("scala.Int") == null) { + abort("scala.dll"); + } + BYTE = getType("System.SByte"); UBYTE = getType("System.Byte"); CHAR = getType("System.Char"); @@ -211,7 +213,7 @@ public final class CLRTypes { /** Load the assembly with the given name */ - private Assembly findAssembly(String name) { + private Assembly findAssembly(String name, boolean required) { // see if the assembly is referenced directly for (Iterator assems = assemrefs.iterator(); assems.hasNext();) { File file = (File)assems.next(); @@ -247,10 +249,11 @@ public final class CLRTypes { return assem; } } - //the Global instance is not yet constructed; use the Reporter from args - args.reporter().error(null, "cannot find assembly " + name + - "; use the -r option to specify its location"); - throw Debug.abort(); + + if (required) + abort(name); + + return null; } /** Load the rest of the assemblies specified with the '-r' option @@ -269,6 +272,13 @@ public final class CLRTypes { assert assemrefs.isEmpty(); } + private void abort(String name) { + //the Global instance is not yet constructed; use the Reporter from args + args.reporter().error(null, "cannot find assembly " + name + + "; use the -r option to specify its location"); + throw Debug.abort(); + } + //########################################################################## // collect the members contained in a given namespace -- cgit v1.2.3