示例#1
0
 public override string ToString()
 {
     if (type == null)
     {
         return("<null>" + value);
     }
     return("<" + type.ToString() + ">" + value);
 }
示例#2
0
        public static IType GetType(CQ_Type type)
        {
            if (type == null)
            {
                return(typess["null"]);
            }

            IType ret = null;

            if (types.TryGetValue(type, out ret) == false)
            {
                DebugUtil.LogWarning("(CQcript)类型未注册,将自动注册一份匿名:" + type.ToString());
                ret = MakeType(type, "");
                RegisterType(ret);
            }
            return(ret);
        }
示例#3
0
        public void DefineAndSet(string name, CQ_Type type, object value)
        {
            if (values == null)
            {
                values = new Dictionary <string, CQ_Value>();
            }
            else if (values.ContainsKey(name))
            {
                throw new Exception(type.ToString() + ":" + name + "已经定义过");
            }

            CQ_Value v = new CQ_Value();

            v.type       = type;
            v.value      = value;
            values[name] = v;

            if (tvalues != null && tvalues.Count > 0)
            {
                tvalues.Peek().Add(name);//暂存临时变量
            }
        }