public void AddType(Type t, string ns) { Utility.AssertNotNull(t, "t"); Utility.AssertNotNull(ns, "namespace"); MyContext.AssertTypeIsAccessible(t); NamespaceImport import = this.GetImport(ns); import.Add(new TypeImport(t, BindingFlags.Public | BindingFlags.Static, false)); }
internal NamespaceImport GetImport(string ns) { if (ns.Length == 0) { return(MyRootImport); } NamespaceImport import = MyRootImport.FindImport(ns) as NamespaceImport; if (import == null) { import = new NamespaceImport(ns); MyRootImport.Add(import); } return(import); }
public void AddMethod(MethodInfo mi, string ns) { Utility.AssertNotNull(mi, "mi"); Utility.AssertNotNull(ns, "namespace"); MyContext.AssertTypeIsAccessible(mi.ReflectedType); if (mi.IsStatic == false | mi.IsPublic == false) { string msg = Utility.GetGeneralErrorMessage(GeneralErrorResourceKeys.OnlyPublicStaticMethodsCanBeImported); throw new ArgumentException(msg); } NamespaceImport import = this.GetImport(ns); import.Add(new MethodImport(mi)); }
internal bool HasNamespace(string ns) { NamespaceImport import = MyRootImport.FindImport(ns) as NamespaceImport; return(import != null); }
internal ExpressionImports() { MyRootImport = new NamespaceImport("true"); }
protected override bool EqualsInternal(ImportBase import) { NamespaceImport otherSameType = import as NamespaceImport; return((otherSameType != null) && _myNamespace.Equals(otherSameType._myNamespace, this.Context.Options.MemberStringComparison)); }