* report.cs: ColorFormat is protected.
* rootcontext.cs: Unused fields clean-up.
* namespace.cs: Made UsingEntry name private.
svn path=/trunk/mcs/; revision=100871
+2008-04-16 Marek Safar <marek.safar@gmail.com>
+
+ * report.cs: ColorFormat is protected.
+
+ * rootcontext.cs: Unused fields clean-up.
+
+ * namespace.cs: Made UsingEntry name private.
+
2008-04-16 Marek Safar <marek.safar@gmail.com>
* cs-tokenizer.cs, location.cs: Removed unused field.
public class NamespaceEntry : IResolveContext {
class UsingEntry {
- public readonly MemberName Name;
+ readonly MemberName name;
Namespace resolved;
public UsingEntry (MemberName name)
{
- Name = name;
+ this.name = name;
}
+ public string GetSignatureForError ()
+ {
+ return name.GetSignatureForError ();
+ }
+
+ public string GetTypeName ()
+ {
+ return name.GetTypeName ();
+ }
+
+ public Location Location {
+ get { return name.Location; }
+ }
+
+ public string Name {
+ get { return name.FullName; }
+ }
+
public Namespace Resolve (IResolveContext rc)
{
if (resolved != null)
return resolved;
- FullNamedExpression fne = Name.GetTypeExpression ().ResolveAsTypeStep (rc, false);
+ FullNamedExpression fne = name.GetTypeExpression ().ResolveAsTypeStep (rc, false);
if (fne == null)
return null;
resolved = fne as Namespace;
if (resolved == null) {
Report.SymbolRelatedToPreviousError (fne.Type);
- Report.Error (138, Name.Location,
+ Report.Error (138, Location,
"`{0}' is a type not a namespace. A using namespace directive can only be applied to namespaces",
- Name.GetSignatureForError ());
+ GetSignatureForError ());
}
return resolved;
}
class LocalUsingAliasEntry : UsingAliasEntry {
Expression resolved;
+ MemberName value;
public LocalUsingAliasEntry (string alias, MemberName name, Location loc)
: base (alias, loc)
{
- this.resolved = name.GetTypeExpression ();
+ this.value = name;
}
public override FullNamedExpression Resolve (IResolveContext rc)
{
- if (resolved == null || resolved.Type != null)
+ if (resolved != null)
return (FullNamedExpression)resolved;
- resolved = resolved.ResolveAsTypeStep (rc, false);
+ resolved = value.GetTypeExpression ().ResolveAsTypeStep (rc, false);
if (resolved == null)
return null;
public bool DeclarationFound = false;
// End
- public readonly int ID;
public readonly bool IsImplicit;
public readonly DeclSpace SlaveDeclSpace;
+ static readonly Namespace [] empty_namespaces = new Namespace [0];
+ Namespace [] namespace_using_table;
static ArrayList entries = new ArrayList ();
this.parent = parent;
this.file = file;
entries.Add (this);
- this.ID = entries.Count;
if (parent != null)
ns = parent.NS.GetNamespace (name, true);
{
this.parent = parent;
this.file = file;
- // no need to add self to 'entries', since we don't have any aliases or using entries.
- this.ID = -1;
this.IsImplicit = true;
this.ns = ns;
this.SlaveDeclSpace = slave ? new RootDeclSpace (this) : null;
using_clauses = new ArrayList ();
} else {
foreach (UsingEntry old_entry in using_clauses) {
- if (name.Equals (old_entry.Name)) {
- Report.SymbolRelatedToPreviousError (old_entry.Name.Location, old_entry.Name.GetSignatureForError ());
- Report.Warning (105, 3, loc, "The using directive for `{0}' appeared previously in this namespace", name.GetName ());
+ if (name.FullName == old_entry.Name) {
+ Report.SymbolRelatedToPreviousError (old_entry.Location, old_entry.GetSignatureForError ());
+ Report.Warning (105, 3, loc, "The using directive for `{0}' appeared previously in this namespace", name.GetSignatureForError ());
return;
}
}
return fne;
}
- // Our cached computation.
- static readonly Namespace [] empty_namespaces = new Namespace [0];
- Namespace [] namespace_using_table;
Namespace [] GetUsingTable ()
{
if (namespace_using_table != null)
if (using_clauses != null) {
using_list = new string [using_clauses.Count];
for (int i = 0; i < using_clauses.Count; i++)
- using_list [i] = ((UsingEntry) using_clauses [i]).Name.GetTypeName ();
+ using_list [i] = ((UsingEntry) using_clauses [i]).GetTypeName ();
}
symfile_id = SymbolWriter.DefineNamespace (ns.Name, file.SourceFileEntry, using_list, parent_id);
Check (code);
}
- public virtual string ColorFormat (string s)
+ protected virtual string ColorFormat (string s)
{
return s;
}
{
}
- public override string ColorFormat (string s)
+ protected override string ColorFormat (string s)
{
if (prefix != null)
return prefix + s + postfix;
public class RootContext {
//
- // Contains the parsed tree
+ // COMPILER OPTIONS CLASS
//
- static RootTypes root;
+ public static Target Target;
+ public static string TargetExt;
+ public static bool VerifyClsCompliance = true;
+ public static bool Optimize = true;
+ public static LanguageVersion Version;
//
- // This hashtable contains all of the #definitions across the source code
- // it is used by the ConditionalAttribute handler.
+ // We keep strongname related info here because
+ // it's also used as complier options from CSC 8.x
//
- public static Hashtable AllDefines = new Hashtable ();
-
+ public static string StrongNameKeyFile;
+ public static string StrongNameKeyContainer;
+ public static bool StrongNameDelaySign;
+
+ //
+ // If set, enable XML documentation generation
+ //
+ public static Documentation Documentation;
+
+ static public string MainClass;
+
+ //
+ // The default compiler checked state
+ //
+ static public bool Checked;
+
+ //
+ // Whether to allow Unsafe code
+ //
+ static public bool Unsafe;
+
//
// Whether we are being linked against the standard libraries.
// This is only used to tell whether `System.Object' should
//
public static bool StdLib;
+ public static bool NeedsEntryPoint {
+ get { return Target == Target.Exe || Target == Target.WinExe; }
+ }
+
+ //
+ // COMPILER OPTIONS CLASS END
+ //
+
+ //
+ // Contains the parsed tree
+ //
+ static RootTypes root;
+
+ //
+ // This hashtable contains all of the #definitions across the source code
+ // it is used by the ConditionalAttribute handler.
+ //
+ public static Hashtable AllDefines = new Hashtable ();
+
//
// This keeps track of the order in which classes were defined
// so that we can poulate them in that order.
static TypeBuilder impl_details_class;
- public static Target Target;
- public static string TargetExt;
-
- public static bool VerifyClsCompliance = true;
-
- /// <summary>
- /// Holds /optimize option
- /// </summary>
- public static bool Optimize = true;
-
- public static LanguageVersion Version;
-
- //
- // We keep strongname related info here because
- // it's also used as complier options from CSC 8.x
- //
- public static string StrongNameKeyFile;
- public static string StrongNameKeyContainer;
- public static bool StrongNameDelaySign;
-
- //
- // If set, enable XML documentation generation
- //
- public static Documentation Documentation;
-
- static public string MainClass;
-
//
// Constructor
//
helper_classes = null;
}
- public static bool NeedsEntryPoint {
- get { return RootContext.Target == Target.Exe || RootContext.Target == Target.WinExe; }
- }
-
static public RootTypes ToplevelTypes {
get { return root; }
}
type_container_resolve_order.Add (tc);
}
- //
- // The default compiler checked state
- //
- static public bool Checked;
-
- //
- // Whether to allow Unsafe code
- //
- static public bool Unsafe;
-
// <remarks>
// This function is used to resolve the hierarchy tree.
// It processes interfaces, structs and classes in that order.
}
}
- //
- // A generic hook delegate
- //
- public delegate void Hook ();
-
- //
- // A hook invoked when the code has been generated.
- //
- public static event Hook EmitCodeHook;
-
//
// DefineTypes is used to fill in the members of each type.
//
foreach (Delegate d in root.Delegates)
d.Emit ();
}
- //
- // Run any hooks after all the types have been defined.
- // This is used to create nested auxiliary classes for example
- //
-
- if (EmitCodeHook != null)
- EmitCodeHook ();
CodeGen.Assembly.Emit (root);
CodeGen.Module.Emit (root);