コード例 #1
0
 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);
     }
 }
コード例 #2
0
 internal void ExitScope()
 {
     Debug.Assert(this.currentScope.parent != null);
     this.currentScope.AddToFreeLocals(freeLocals);
     this.currentScope = this.currentScope.parent;
 }
コード例 #3
0
 public LocalScope(LocalScope parent) : this() {
     this.parent = parent;
 }
コード例 #4
0
 internal void EnterScope() {
     LocalScope newScope = new LocalScope(this.currentScope);
     this.currentScope = newScope;
 }
コード例 #5
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;
        }
コード例 #6
0
ファイル: CodeGenerator.cs プロジェクト: dotnet/corefx
 internal void ExitScope()
 {
     Debug.Assert(_currentScope.parent != null);
     _currentScope.AddToFreeLocals(_freeLocals);
     _currentScope = _currentScope.parent;
 }
コード例 #7
0
ファイル: CodeGenerator.cs プロジェクト: dotnet/corefx
 internal void EnterScope()
 {
     LocalScope newScope = new LocalScope(_currentScope);
     _currentScope = newScope;
 }
コード例 #8
0
ファイル: CodeGenerator.cs プロジェクト: dotnet/corefx
        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;
        }