示例#1
0
文件: DataType.cs 项目: lee1431/uno
        public void Visit(Pass p, bool recursive = true)
        {
            if (!p.Begin(this))
            {
                return;
            }

            var old = p.Type;

            p.Type = this;

            if (recursive)
            {
                for (int i = 0; i < NestedTypes.Count; i++)
                {
                    NestedTypes[i].Visit(p);
                }
            }

            p.Function = DummyMethod;

            Initializer?.Visit(p);
            Finalizer?.Visit(p);

            for (int i = 0; i < Methods.Count; i++)
            {
                Methods[i].Visit(p);
            }
            for (int i = 0; i < Constructors.Count; i++)
            {
                Constructors[i].Visit(p);
            }

            for (int i = 0; i < Properties.Count; i++)
            {
                var m = Properties[i];
                m.GetMethod?.Visit(p);
                m.SetMethod?.Visit(p);
            }

            for (int i = 0; i < Events.Count; i++)
            {
                var m = Events[i];
                m.AddMethod?.Visit(p);
                m.RemoveMethod?.Visit(p);
            }

            for (int i = 0; i < Operators.Count; i++)
            {
                Operators[i].Visit(p);
            }
            for (int i = 0; i < Casts.Count; i++)
            {
                Casts[i].Visit(p);
            }

            p.Function = null;

            Block?.Visit(p);

            p.Type = old;
            p.End(this);
        }