コード例 #1
0
ファイル: codegen_c.cs プロジェクト: hlorenzi/trapl
        private void GatherItems()
        {
            var structs = session.GetStructs();

            for (var i = 0; i < structs.Count; i++)
            {
                var st = new Item {
                    kind = Item.Kind.Struct, index = i
                };
                var sth = new Item {
                    kind = Item.Kind.StructHeader, index = i
                };
                itemGraph.AddNode(st);
                itemGraph.AddNode(sth);
                itemStructs.Add(st);
                itemStructHeaders.Add(sth);
            }

            var functs = session.GetFuncts();

            for (var i = 0; i < functs.Count; i++)
            {
                var fn = new Item {
                    kind = Item.Kind.Funct, index = i
                };
                var fnh = new Item {
                    kind = Item.Kind.FunctHeader, index = i
                };
                itemGraph.AddNode(fn);
                itemGraph.AddNode(fnh);
                itemFuncts.Add(fn);
                itemFunctHeaders.Add(fnh);
            }
        }
コード例 #2
0
        public static bool Check(Core.Session session)
        {
            var foundErrors = false;

            var structs = session.GetStructs();

            for (var i = 0; i < structs.Count; i++)
            {
                var seenStructs = new Stack <int>();
                foundErrors |= CheckStruct(session, i, seenStructs);
            }

            return(foundErrors);
        }