private bool SubjectIsStruct() { if (!(LeftExp is ExpVar)) { return(false); } ExpVar varexp = LeftExp as ExpVar; return(ReflectionUtil.IsStruct(varexp.RetType.SharpType)); }
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); }
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); }
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); }
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); }