Ejemplo n.º 1
0
        private TypeGen GenerateModuleGlobalsType(AssemblyGen ag)
        {
            TypeGen tg = ag.DefinePublicType(ModuleName == "ironscheme.boot.new" ? "#" : ModuleName, typeof(CustomSymbolDictionary));

            tg.AddCodeContextField();
            tg.DefaultConstructor = tg.TypeBuilder.DefineDefaultConstructor(MethodAttributes.Public);

            return(tg);
        }
Ejemplo n.º 2
0
        internal static CodeGen CreateDebuggableDynamicCodeGenerator(CompilerContext context, string name, Type retType, IList <Type> paramTypes, IList <string> paramNames, ConstantPool constantPool)
        {
            TypeGen tg = ScriptDomainManager.CurrentManager.Snippets.DefineDebuggableType(name, context.SourceUnit);
            CodeGen cg = tg.DefineMethod("Initialize", retType, paramTypes, paramNames, constantPool);

            tg.AddCodeContextField();
            cg.DynamicMethod = true;

            return(cg);
        }
Ejemplo n.º 3
0
        public TypeGen DefineNestedType(string name, Type parent)
        {
            TypeBuilder tb = _myType.DefineNestedType(name, TypeAttributes.NestedPublic);

            tb.SetParent(parent);
            TypeGen ret = new TypeGen(_myAssembly, tb);

            _nestedTypeGens.Add(ret);

            ret.AddCodeContextField();

            return(ret);
        }
Ejemplo n.º 4
0
        private TypeGen GenerateModuleGlobalsType(AssemblyGen ag, ScriptCode sc)
        {
            var n = sc.CodeBlock.Name;

            switch (n)
            {
            case "visit-code":
            case "invoke-code":
            case "guard-code":
                TypeGen tg = ag.DefinePublicType("syntax-" + sc.CodeBlock.Name, typeof(CustomSymbolDictionary));
                tg.AddCodeContextField();
                tg.DefaultConstructor = tg.TypeBuilder.DefineDefaultConstructor(MethodAttributes.Public);
                return(tg);

            default:
                return(GenerateModuleGlobalsType(ag));
            }
        }
Ejemplo n.º 5
0
        public TypeGen DefineNestedType(string name, Type parent) {
            TypeBuilder tb = _myType.DefineNestedType(name, TypeAttributes.NestedPublic);
            tb.SetParent(parent);
            TypeGen ret = new TypeGen(_myAssembly, tb);
            _nestedTypeGens.Add(ret);

            ret.AddCodeContextField();

            return ret;
        }