Esempio n. 1
0
        public GenerateResult Generate()
        {
            var unitMap = new Dictionary <string, CompileUnit>();

            // 生成类型代码
            var types = TypeMgr.Types;

            foreach (TypeX tyX in types)
            {
                CompileUnit unit = new TypeGenerator(this, tyX).Generate();
                unitMap.Add(unit.Name, unit);
            }

            // 合并代码单元
            var transMap = new CompileUnitMerger(unitMap).Merge();

            // 生成字符串常量单元
            if (StrGen.HasStrings)
            {
                StrGen.Generate(unitMap, GetStringTypeID());
            }

            // 生成初始化单元
            var unitInit = GenInitUnit(transMap);

            unitMap[unitInit.Name] = unitInit;

            return(new GenerateResult(this, unitMap.Values.ToList(), transMap));
        }
Esempio n. 2
0
        public GenerateResult Generate()
        {
            var unitMap = new Dictionary <string, CompileUnit>();

            // 生成类型代码
            var types = TypeMgr.Types;

            foreach (TypeX tyX in types)
            {
                CompileUnit unit = new TypeGenerator(this, tyX).Generate();
                unitMap.Add(unit.Name, unit);
            }

            // 合并代码单元
            var transMap = new CompileUnitMerger(unitMap).Merge();

            // 生成字符串常量单元
            TypeX strTyX = GetTypeByName("String");

            if (strTyX != null)
            {
                StrGen.Generate(unitMap, GetTypeID(strTyX));
            }

            return(new GenerateResult(this, unitMap.Values.ToList(), transMap));
        }
Esempio n. 3
0
        public GenerateResult Generate()
        {
            var units = new Dictionary <string, CompileUnit>();

            // 生成类型代码
            var types = TypeMgr.Types;

            foreach (TypeX tyX in types)
            {
                CompileUnit unit = new TypeGenerator(this, tyX).Generate();
                units.Add(unit.Name, unit);
            }

            var merger   = new CompileUnitMerger(units);
            var transMap = merger.Merge();

            return(new GenerateResult(this, merger.UnitMap.Values.ToList(), transMap));
        }
Esempio n. 4
0
 public StringGenerator(TypeGenerator typeGen)
 {
     TypeGen = typeGen;
 }