" -help Lists all compiler options (short: -?)\n" +
" -keycontainer:NAME The key pair container used to sign the output assembly\n" +
" -keyfile:FILE The key file used to strongname the ouput assembly\n" +
- " -langversion:TEXT Specifies language version: ISO-1, ISO-2, Default, or future\n" +
+ " -langversion:TEXT Specifies language version: ISO-1, ISO-2, Default, or Future\n" +
" -lib:PATH1[,PATHn] Specifies the location of referenced assemblies\n" +
" -main:CLASS Specifies the class with the Main method (short: -m)\n" +
" -noconfig Disables implicitly referenced assemblies\n" +
" KIND can be one of: exe, winexe, library, module\n" +
" -unsafe[+|-] Allows to compile code which uses unsafe keyword\n" +
" -warnaserror[+|-] Treats all warnings as errors\n" +
- " -warnaserror:W1[,Wn] Treats one or more compiler warnings as errors\n" +
+ " -warnaserror[+|-]:W1[,Wn] Treats one or more compiler warnings as errors\n" +
" -warn:0-4 Sets warning level, the default is 4 (short -w:)\n" +
" -help2 Shows internal compiler options\n" +
"\n" +
if (d == null)
return 1;
- else if (d.Compile () && Report.Errors == 0) {
+ if (d.Compile () && Report.Errors == 0) {
if (Report.Warnings > 0) {
Console.WriteLine ("Compilation succeeded - {0} warning(s)", Report.Warnings);
}
+ Environment.Exit (0);
return 0;
- } else {
- Console.WriteLine("Compilation failed: {0} error(s), {1} warnings",
- Report.Errors, Report.Warnings);
- return 1;
}
+
+
+ Console.WriteLine("Compilation failed: {0} error(s), {1} warnings",
+ Report.Errors, Report.Warnings);
+ Environment.Exit (1);
+ return 1;
}
static public void LoadAssembly (string assembly, bool soft)
// Extern aliased refs require special handling
if (alias == null)
- RootNamespace.Global.AddAssemblyReference (a);
+ GlobalRootNamespace.Instance.AddAssemblyReference (a);
else
- RootNamespace.DefineRootNamespace (alias, a);
+ GlobalRootNamespace.Instance.DefineRootNamespace (alias, a);
} catch (BadImageFormatException f) {
// .NET 2.0 throws this if we try to load a module without an assembly manifest ...
}
}
- RootNamespace.Global.AddModuleReference (m);
+ GlobalRootNamespace.Instance.AddModuleReference (m);
} catch (BadImageFormatException f) {
Error9 ("module", f.FileName, f.FusionLog);
foreach (DictionaryEntry entry in external_aliases)
LoadAssembly ((string) entry.Value, (string) entry.Key, false);
- RootNamespace.ComputeNamespaces ();
+ GlobalRootNamespace.Instance.ComputeNamespaces ();
}
static string [] LoadArgs (string file)
Report.Fatal = true;
return true;
- case "--werror":
- Report.Warning (-29, 1, "Compatibility: Use -warnaserror: option instead of --werror");
- Report.WarningsAreErrors = true;
- return true;
-
case "--nowarn":
Report.Warning (-29, 1, "Compatibility: Use -nowarn instead of --nowarn");
if ((i + 1) >= args.Length){
return true;
case "/warnaserror":
+ case "/warnaserror+":
if (value.Length == 0) {
Report.WarningsAreErrors = true;
} else {
}
return true;
- case "/warnaserror+":
- Report.WarningsAreErrors = true;
- return true;
-
case "/warnaserror-":
- Report.WarningsAreErrors = false;
+ if (value.Length == 0) {
+ Report.WarningsAreErrors = false;
+ } else {
+ foreach (string wid in value.Split (argument_value_separator))
+ Report.RemoveWarningAsError (wid);
+ }
return true;
case "/warn":
//
public bool Compile ()
{
+ // TODO: Should be passed to parser as an argument
+ RootContext.ToplevelTypes = new ModuleContainer (RootContext.Unsafe);
+
Parse ();
if (Report.Errors > 0)
return false;
set_method.Invoke (CodeGen.Assembly.Builder, BindingFlags.Default, null, new object[]{true}, null);
}
- RootNamespace.Global.AddModuleReference (CodeGen.Module.Builder);
+ GlobalRootNamespace.Instance.AddModuleReference (RootContext.ToplevelTypes.Builder);
//
// Load assemblies required
if (timestamps)
ShowTime (" Core Types done");
- CodeGen.Module.Resolve ();
-
//
// The second pass of the compiler
//
{
Driver.Reset ();
RootContext.Reset (full_flag);
- Tokenizer.Reset ();
Location.Reset ();
Report.Reset ();
TypeManager.Reset ();
+ PredefinedAttributes.Reset ();
TypeHandle.Reset ();
if (full_flag)
- RootNamespace.Reset ();
+ GlobalRootNamespace.Reset ();
NamespaceEntry.Reset ();
CodeGen.Reset ();