Пример #1
0
 public RootStructure(string name, string dir = null)
 {
     Name = name;
     FileName = name + ".exe";
     Assembly = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName(Name), AssemblyBuilderAccess.RunAndSave, dir);
     Module = Assembly.DefineDynamicModule(Name, FileName, true);
     var attr = MethodAttributes.PrivateScope | MethodAttributes.SpecialName | MethodAttributes.Static;
     var arg = new List<ParameterStructure>();
     var gnr = new List<GenericParameterStructure>();
     EntryContext = new MethodStructure();
     EntryContext.Initialize("@@entry", false, attr, gnr, arg, null);
     AppendChild(EntryContext);
 }
 public GlobalContextStructure(string name, BlockStructure block)
 {
     Name = name;
     Block = block;
     var tattr = TypeAttributes.Class | TypeAttributes.NotPublic | TypeAttributes.Sealed | TypeAttributes.SpecialName;
     var gnr = new List<GenericParameterStructure>();
     var imp = new List<TypeStructure>();
     GlobalField = new PureTypeStructure();
     GlobalField.Initialize(Name + ".@@Global", tattr, gnr, null, imp);
     AppendChild(GlobalField);
     var mattr = MethodAttributes.PrivateScope | MethodAttributes.SpecialName | MethodAttributes.Static;
     var arg = new List<ParameterStructure>();
     var gnr2 = new List<GenericParameterStructure>();
     GlobalContext = new MethodStructure();
     GlobalContext.Initialize("@@global", false, mattr, gnr2, arg, null);
     GlobalField.AppendChild(GlobalContext);
     AppendChild(Block);
 }