コード例 #1
0
        private bool SubjectIsStruct()
        {
            if (!(LeftExp is ExpVar))
            {
                return(false);
            }
            ExpVar varexp = LeftExp as ExpVar;

            return(ReflectionUtil.IsStruct(varexp.RetType.SharpType));
        }
コード例 #2
0
        private List <ExpVar> GetAllSubExpVars(Exp exp)
        {
            List <Exp>    exps    = GetAllSubExps(exp);
            List <ExpVar> results = new List <ExpVar>();

            foreach (var item in exps)
            {
                if (item is ExpVar)
                {
                    ExpVar varExp = item as ExpVar;
                    if (results.IndexOf(varExp) == -1)
                    {
                        results.Add(varExp);
                    }
                }
            }
            return(results);
        }
コード例 #3
0
        private bool EmitAsVar()
        {
            ExpVar varexp = LeftExp as ExpVar;

            if (ReflectionUtil.IsStruct(varexp.RetType.SharpType))
            {
                if (varexp.VarSymbol is SymbolLocalVar)
                {
                    IL.Emit(OpCodes.Ldloca, (varexp.VarSymbol as SymbolLocalVar).VarBuilder);
                    return(true);
                }
                else if (varexp.VarSymbol is SymbolArg)
                {
                    IL.Emit(OpCodes.Ldarga, (varexp.VarSymbol as SymbolArg).ArgIndex);
                    return(true);
                }
            }
            return(false);
        }
コード例 #4
0
        private List <SymbolBase> GetAllSubVars(List <ExpVar> exps)
        {
            List <SymbolBase> results = new List <SymbolBase>();

            foreach (var item in exps)
            {
                if (item is ExpVar)
                {
                    ExpVar varExp = item as ExpVar;

                    if (varExp.VarSymbol is SymbolArg || varExp.VarSymbol is SymbolLocalVar)
                    {
                        if (results.IndexOf(varExp.VarSymbol) == -1)
                        {
                            results.Add(varExp.VarSymbol);
                        }
                    }
                }
            }
            return(results);
        }
コード例 #5
0
 private bool ParseRightPropertyName()
 {
     if (RightExp is ExpVar)
     {
         ExpVar propertyExp = (RightExp as ExpVar);
         propertyName = propertyExp.VarToken.GetText();
         return(true);
     }
     else if (RightExp is ExpType)
     {
         ExpType typeExp  = (RightExp as ExpType);
         Token   newToken = typeExp.ToSingleToken();
         propertyName = newToken.GetText();
         return(true);
     }
     else
     {
         ErrorE(RightExp.Postion, "'的'后面的‘{0}’不是属性名称", RightExp.ToString());
     }
     return(false);
 }