private object DoGetNamespace(CsUsingDirective u)
 {
     return u.Namespace;
 }
Example #2
0
        public CsNamespace(CsBody body, string name, CsExternAlias[] externs, CsUsingAlias[] aliases, CsUsingDirective[] uses, CsNamespace[] namespaces, CsType[] types, int offset, int length, int line)
            : base(body, types, offset, length, line)
        {
            Contract.Requires(!string.IsNullOrEmpty(name), "name is null or empty");
            Contract.Requires(externs != null, "externs is null");
            Contract.Requires(aliases != null, "aliases is null");
            Contract.Requires(uses != null, "uses is null");
            Contract.Requires(namespaces != null, "namespaces is null");

            Name = name;
            Externs = externs;
            Aliases = aliases;
            Uses = uses;
            Namespaces = namespaces;

            var decs = new List<CsDeclaration>();
            decs.AddRange(namespaces);
            SetDeclarations(decs);

            foreach (CsNamespace n in Namespaces)
                n.Namespace = this;
            foreach (CsType t in Types)
                t.Namespace = this;
        }
Example #3
0
        private bool DoIsSorted(CsUsingDirective[] uses)
        {
            for (int i = 1; i < uses.Length; ++i)
            {
                if (uses[i - 1].Namespace.CompareTo(uses[i].Namespace) > 0)
                    return false;
            }

            return true;
        }
Example #4
0
        public CsGlobalNamespace(CsPreprocess[] preprocess, CsBody body, CsAttribute[] attrs, CsExternAlias[] externs, CsUsingAlias[] aliases, CsUsingDirective[] uses, CsNamespace[] namespaces, CsType[] types, int length)
            : base(body, "<globals>", externs, aliases, uses, namespaces, types, 0, length, 1)
        {
            Contract.Requires(attrs != null, "attrs is null");
            Contract.Requires(preprocess != null, "preprocess is null");

            Attributes = attrs;
            Preprocess = preprocess;
        }