Beispiel #1
0
        public override AST.Declaration VisitClass(Class @class)
        {
            var _class = new AST.Class();

            VisitClass(@class, _class);

            return(_class);
        }
Beispiel #2
0
        void VisitClass(Class @class, AST.Class _class)
        {
            VisitDeclaration(@class, _class);
            VisitDeclContext(@class, _class);

            for (uint i = 0; i < @class.BasesCount; ++i)
            {
                var @base = @class.getBases(i);
                var _base = VisitBaseClassSpecifier(@base);
                _class.Bases.Add(_base);
            }

            for (uint i = 0; i < @class.FieldsCount; ++i)
            {
                var field  = @class.getFields(i);
                var _field = Visit(field) as AST.Field;
                _class.Fields.Add(_field);
            }

            for (uint i = 0; i < @class.MethodsCount; ++i)
            {
                var method  = @class.getMethods(i);
                var _method = Visit(method) as AST.Method;
                _class.Methods.Add(_method);
            }

            for (uint i = 0; i < @class.SpecifiersCount; ++i)
            {
                var spec  = @class.getSpecifiers(i);
                var _spec = Visit(spec) as AST.AccessSpecifierDecl;
                _class.Specifiers.Add(_spec);
            }

            _class.IsPOD         = @class.IsPOD;
            _class.IsAbstract    = @class.IsAbstract;
            _class.IsUnion       = @class.IsUnion;
            _class.IsDynamic     = @class.IsDynamic;
            _class.IsPolymorphic = @class.IsPolymorphic;
            _class.HasNonTrivialDefaultConstructor = @class.HasNonTrivialDefaultConstructor;
            _class.HasNonTrivialCopyConstructor    = @class.HasNonTrivialCopyConstructor;
            _class.HasNonTrivialDestructor         = @class.HasNonTrivialDestructor;
            _class.IsExternCContext = @class.IsExternCContext;

            if (@class.Layout != null)
            {
                _class.Layout = VisitClassLayout(@class.Layout);
            }
        }