Пример #1
0
    public void DoVarIter(DoVarDef e)
    {
	e.Iter.Visit(this);
	il.Emit(OpCodes.Stloc, (LocalBuilder)DoVars[e.Pos]);
    }
Пример #2
0
    public void DoVarDef(DoVarDef e)
    {
	LocalBuilder lt = il.DeclareLocal(e.Init.ExpType);
	DoVars.Add(e.Pos, lt);
	e.Init.Visit(this);
	il.Emit(OpCodes.Stloc, lt);
    }
Пример #3
0
    public void DoVarDef(DoVarDef e)
    {
	e.Init.Visit(this);
	if (e.Init.ExpType != typeof(void)){          //If type of init is known put it in.
	    if(DoVars[e.Pos] == null) 
		DoVars.Add(e.Pos, e.Init.ExpType);          //Else DoVarExp will add typeof(void)
	}
	
	e.Iter.Visit(this);
	if (e.Init.ExpType == typeof(void) && e.Init is VarExp){ //If e.Init is VarExp which currently has no type.
	    e.Init.ExpType = (Type)DoVars[e.Pos];                //Assign it since now we know the type required.
	    CurrentFuncDef.Add(((VarExp)e.Init).Name, e.Init.ExpType);
	}
	
	if (e.Init.ExpType != e.Iter.ExpType ){
	    Console.WriteLine("Do Expression: Init and Iterations have different type");
	    success = false;
	}
	
    }