Beispiel #1
0
        string ExpressionToString(Metadata.Expression.FieldExp es)
        {
            ITypeConverter tc = Converter.GetTypeConverter(Model.currentType);

            if (tc != null)
            {
                string content;
                if (tc.ConvertFieldExp(Converter, Model.currentType, es, out content))
                {
                    return(content);
                }
            }

            if (es.Caller == null)   //本地变量或者类变量,或者全局类
            {
                return(es.Name);
            }
            else
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append(ExpressionToString(es.Caller));

                Metadata.DB_Type caller_type = null;

                if (es.Caller is Metadata.Expression.IndifierExp)
                {
                    Metadata.Expression.IndifierExp ie = es.Caller as Metadata.Expression.IndifierExp;
                    Metadata.Model.IndifierInfo     ii = Model.GetIndifierInfo(ie.Name);
                    if (ii.is_namespace || ii.is_type)
                    {
                        stringBuilder.Append("::");
                        caller_type = null;
                    }
                    else
                    {
                        caller_type = ii.type;
                    }
                }
                else
                {
                    caller_type = Model.GetExpType(es.Caller);
                }

                if (caller_type != null)
                {
                    if (caller_type.is_class)
                    {
                        //Metadata.DB_Member member = caller_type.members[es.Name];
                        //if (member.is_static)
                        stringBuilder.Append("->");
                        //else if (member.member_type == (int)Metadata.MemberTypes.Method)
                        //{

                        //}
                    }
                    else
                    {
                        stringBuilder.Append(".");
                    }
                }

                stringBuilder.Append(es.Name);
                return(stringBuilder.ToString());
            }
        }
Beispiel #2
0
 public bool ConvertFieldExp(IConverter Converter, Metadata.DB_Type type, Metadata.Expression.FieldExp fe, out string exp_string)
 {
     exp_string = "";
     return(false);
 }