Esempio n. 1
0
        //public static explicit operator int(Block block)
        //{
        //    if (block.FinalType == FinalReturnType.Int)
        //    {
        //        return block.intValue;
        //    }
        //    throw new RuntimeException("");
        //}
        #endregion

        #region as callable

        internal Block SetValue(List <Stmt> stmts)
        {
            if (stmts.Any())
            {
                FinalType  = FinalReturnType.Stmts;
                this.stmts = stmts;
                foreach (var stmt in stmts)
                {
                    stmt.parent = this;
                }
            }
            else
            {
                throw new RuntimeException("不能创建没有语句的block");
            }
            return(this);
        }
Esempio n. 2
0
 internal Block SetValue(bool value)
 {
     FinalType = FinalReturnType.Bool;
     boolValue = value;
     return(this);
 }
Esempio n. 3
0
 internal Block SetValue(string value)
 {
     FinalType = FinalReturnType.String;
     strValue  = value;
     return(this);
 }
Esempio n. 4
0
 internal Block SetValue(int value)
 {
     FinalType = FinalReturnType.Int;
     intValue  = value;
     return(this);
 }
Esempio n. 5
0
 internal Block SetValue(IOJMethod method)
 {
     FinalType   = FinalReturnType.OJMethod;
     this.method = method;
     return(this);
 }