Example #1
0
        private ProcScope CreateInterfaceNamespaceFunction(string name, int offset)
        {
            //Console.WriteLine(name);
            ProcScope cnfn = new ProcScope(name, cur_scope);

            cnfn.declaringUnit = root_scope;
            if (CanReadObject())
            {
                br.ReadInt32();
            }
            br.ReadBoolean(); //ïðîïóñêàåì ôëàã - èíòåðôåéñíîñòè
            br.ReadInt32();   //name index
            bool is_generic = br.ReadBoolean();

            if (is_generic)
            {
                throw new NotSupportedException();
            }
            if (br.ReadByte() == 1)
            {
                cnfn.return_type = GetTypeReference();
                GetLocalVariable(cnfn);
            }
            int num_par = br.ReadInt32();

            for (int i = 0; i < num_par; i++)
            {
                cnfn.parameters.Add(GetParameter(cnfn));
            }
            br.ReadInt32();             //namespace
            br.ReadInt32();             //attributes
            cnfn.is_forward = br.ReadBoolean();
            cnfn.Complete();
            AddMember(cnfn, offset);
            return(cnfn);
        }
Example #2
0
        private ProcScope CreateInterfaceMethod(string name, int offset)
        {
            ProcScope cmn = members[offset] as ProcScope;

            if (cmn != null)
            {
                return(cmn);
            }
            cmn = new ProcScope(name, cur_scope);
            cmn.declaringUnit = root_scope;
            //members[offset] = cmn;
            AddMember(cmn, offset);

            int name_ref = br.ReadInt32();

            br.ReadByte();
            br.ReadByte();
            bool is_generic = br.ReadBoolean();

            if (is_generic)
            {
                throw new NotSupportedException();
            }
            //ssyy

            //\ssyy

            if (br.ReadByte() == 1) //return_value_type
            {
                cmn.return_type = GetTypeReference();
                if (br.ReadByte() == 1)
                {
                    GetLocalVariable(cmn);
                }
            }
            int num_par = br.ReadInt32();

            for (int i = 0; i < num_par; i++)
            {
                cmn.parameters.Add(GetParameter(cmn));
            }
            br.ReadInt32();
            br.ReadInt32();
            cmn.is_constructor = br.ReadBoolean();
            cmn.is_forward     = br.ReadBoolean();
            br.ReadBoolean();
            PascalABCCompiler.SemanticTree.field_access_level fal = (PascalABCCompiler.SemanticTree.field_access_level)br.ReadByte();
            PascalABCCompiler.SemanticTree.polymorphic_state  ps  = (PascalABCCompiler.SemanticTree.polymorphic_state)br.ReadByte();
            switch (fal)
            {
            case PascalABCCompiler.SemanticTree.field_access_level.fal_internal: cmn.acc_mod = access_modifer.internal_modifer; break;

            case PascalABCCompiler.SemanticTree.field_access_level.fal_private: cmn.acc_mod = access_modifer.private_modifer; return(null);

            case PascalABCCompiler.SemanticTree.field_access_level.fal_protected: cmn.acc_mod = access_modifer.protected_modifer; break;

            case PascalABCCompiler.SemanticTree.field_access_level.fal_public: cmn.acc_mod = access_modifer.public_modifer; break;
            }

            switch (ps)
            {
            case PascalABCCompiler.SemanticTree.polymorphic_state.ps_static: cmn.is_static = true; break;

            case PascalABCCompiler.SemanticTree.polymorphic_state.ps_virtual: cmn.is_virtual = true; break;
            }
            br.ReadInt32(); br.ReadInt32();
            cmn.is_override = br.ReadBoolean() == true;
            cmn.Complete();
            return(cmn);
        }