/// <summary> /// Constructor Takes the current namespace and the /// name. This is bootstrapped with parent == null /// and name = "" /// </summary> public Namespace(Namespace parent, string name) { // Expression members. this.eclass = ExprClass.Namespace; this.Type = InternalType.Namespace; this.loc = Location.Null; this.parent = parent; if (parent != null) { this.root = parent.root; } else { this.root = this as RootNamespace; } if (this.root == null) { throw new InternalErrorException("Root namespaces must be created using RootNamespace"); } string pname = parent != null ? parent.fullname : ""; if (pname == "") { fullname = name; } else { fullname = parent.fullname + "." + name; } if (fullname == null) { throw new InternalErrorException("Namespace has a null fullname"); } if (parent != null && parent.MemberName != MemberName.Null) { MemberName = new MemberName(parent.MemberName, name); } else if (name.Length == 0) { MemberName = MemberName.Null; } else { MemberName = new MemberName(name); } namespaces = new Dictionary <string, Namespace> (); cached_types = new Dictionary <string, TypeExpr> (); root.RegisterNamespace(this); }