/// <summary> /// var文のコンパイル /// </summary> /// <param name="ilgen">IL Generator</param> /// <param name="stmt">var文</param> static void CompileVarStmt(ILGenerator ilgen, MVarStmt stmt) { CompileExpr(ilgen, stmt.Expr); var builder = ilgen.DeclareLocal(stmt.Expr.Type.Reduce()); _scope_manager.Add(stmt.Pos, stmt.Name, new LocalVar(builder)); ilgen.Emit(OpCodes.Stloc, builder); }
/// <summary> /// var文の型推論 /// </summary> /// <param name="stmt">var文</param> static void TypeinfVarStmt(MVarStmt stmt) { TypeinfExpr(stmt.Expr); env.Add(stmt.Pos, stmt.Name, stmt.Expr.Type); }