void InitILGeneration(Type[] argTypes, string[] argNames, bool isStatic) {
     this.methodEndLabel = ilGen.DefineLabel();
     this.retLabel = ilGen.DefineLabel();
     this.blockStack = new Stack();
     this.whileStack = new Stack();
     this.currentScope = new LocalScope();
     this.freeLocals = new Dictionary<Tuple<Type, string>, Queue<LocalBuilder>>(); 
     this.argList = new Dictionary<string, ArgBuilder>();
     // this ptr is arg 0 for non static, assuming ref type (not value type) 
     if (!isStatic)
         argList.Add("this", new ArgBuilder("this", 0, this.typeBuilder.BaseType));
     for (int i = 0; i < argTypes.Length; i++) {
         ArgBuilder arg = new ArgBuilder(argNames[i], argList.Count, argTypes[i]);
         argList.Add(arg.Name, arg);
         this.methodBuilder.DefineParameter(arg.Index, ParameterAttributes.None, arg.Name);
     }
 }
 internal void ExitScope()
 {
     Debug.Assert(this.currentScope.parent != null);
     this.currentScope.AddToFreeLocals(freeLocals);
     this.currentScope = this.currentScope.parent;
 }
 public LocalScope(LocalScope parent) : this() {
     this.parent = parent;
 }
 internal void EnterScope() {
     LocalScope newScope = new LocalScope(this.currentScope);
     this.currentScope = newScope;
 }
        internal MethodBuilder EndMethod() {
            MarkLabel(methodEndLabel);
            Ret();

            MethodBuilder retVal = null;
            retVal = methodBuilder;
            methodBuilder = null;
            ilGen = null;
            freeLocals = null;
            blockStack = null;
            whileStack = null;
            argList = null;
            currentScope = null;
            retLocal = null;
            return retVal;
        }
Example #6
0
 internal void ExitScope()
 {
     Debug.Assert(_currentScope.parent != null);
     _currentScope.AddToFreeLocals(_freeLocals);
     _currentScope = _currentScope.parent;
 }
Example #7
0
 internal void EnterScope()
 {
     LocalScope newScope = new LocalScope(_currentScope);
     _currentScope = newScope;
 }
Example #8
0
        internal MethodBuilder EndMethod()
        {
            MarkLabel(_methodEndLabel);
            Ret();

            MethodBuilder retVal = null;
            retVal = _methodBuilder;
            _methodBuilder = null;
            _ilGen = null;
            _freeLocals = null;
            _blockStack = null;
            _whileStack = null;
            _argList = null;
            _currentScope = null;
            retLocal = null;
            return retVal;
        }