Index: ncc/codedom/NemerleCodeGenerator.n =================================================================== --- ncc/codedom/NemerleCodeGenerator.n (revision 6061) +++ ncc/codedom/NemerleCodeGenerator.n (working copy) @@ -556,6 +556,56 @@ Output.Write("mutable "); } + private OutputTypeAttributes (declaration : CodeTypeDeclaration) : void + { + def output = Output; + def attributes = declaration.TypeAttributes; + + match (attributes & TypeAttributes.VisibilityMask) { + | TypeAttributes.Public + | TypeAttributes.NestedPublic => + output.Write ("public "); + | TypeAttributes.NestedPrivate => + output.Write ("private "); + | TypeAttributes.NotPublic + | TypeAttributes.NestedFamANDAssem + | TypeAttributes.NestedAssembly => + output.Write ("internal "); + | TypeAttributes.NestedFamily => + output.Write ("protected "); + | TypeAttributes.NestedFamORAssem => + output.Write ("protected internal "); + | _ => + (); + } + + match (declaration) { + | d when d.IsStruct => + when (d.IsPartial) { + output.Write ("partial "); + } + output.Write ("struct "); + | d when d.IsEnum => + output.Write ("enum "); + | _ => + if ((attributes & TypeAttributes.Interface) != 0) { + when (declaration.IsPartial) { + output.Write ("partial "); + } + output.Write ("interface "); + } else { + when ((attributes & TypeAttributes.Sealed) != 0) + output.Write ("sealed "); + when ((attributes & TypeAttributes.Abstract) != 0) + output.Write ("abstract "); + when (declaration.IsPartial) { + output.Write ("partial "); + } + output.Write ("class "); + } + } + } + protected override GenerateSnippetMember (member : CodeSnippetTypeMember) : void { Output.Write (member.Text); @@ -749,10 +799,7 @@ when (declaration.CustomAttributes.Count > 0) OutputAttributeDeclarations ( declaration.CustomAttributes ); - def attributes = declaration.TypeAttributes; - OutputTypeAttributes (attributes, - declaration.IsStruct, - declaration.IsEnum ); + OutputTypeAttributes (declaration); output.Write (GetSafeName (declaration.Name)); Index: ncc/codedom/NemerleCodeCompiler.n =================================================================== --- ncc/codedom/NemerleCodeCompiler.n (revision 6061) +++ ncc/codedom/NemerleCodeCompiler.n (working copy) @@ -39,6 +39,7 @@ using System.Configuration; using System.IO; using System.Text; +using System.Text.RegularExpressions; using System.Reflection; using System.Collections; using System.Collections.Specialized; @@ -46,6 +47,7 @@ using Nemerle.Assertions; using Nemerle.Collections; +using Nemerle.Utility; namespace Nemerle.Compiler { @@ -125,6 +127,15 @@ err_event (true, loc, msg); } + mutable files = []; + def opts = Options.GetCommonOptions () + [ + Getopt.CliOption.NonOption (name = "", + help = "Specify file to compile", + handler = fun (s) { files = s :: files }) + ]; + Getopt.Parse (Message.Error, opts, + List.FromArray (Regex.Split (options.CompilerOptions, @"\s")).Filter (fun (t) {t.Length > 0})); + def fullOutput = System.IO.StringWriter (); Message.InitOutput (fullOutput); Options.ProgressBar = false; @@ -144,7 +155,7 @@ if (fileNames.Length < 1) Message.Error ("need at least one file to compile"); else { - Options.Sources = List.FromArray (fileNames); + Options.Sources = files + List.FromArray (fileNames); Passes.Run (); succeeded = !failed; }