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)); }
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)); }
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)); }
public StringGenerator(TypeGenerator typeGen) { TypeGen = typeGen; }