/// <summary> /// Either external function or member name. /// </summary> /// <returns></returns> public object VisitMemberAccess(MemberAccessExpr expr) { var memberAccess = MemberHelper.GetMemberAccess(expr, this.Ctx, expr.VarExp, expr.MemberName, this); if (expr.IsAssignment) return memberAccess; if (memberAccess.MemberMissing) throw expr.BuildRunTimeException("Member : " + expr.MemberName + " does not exist"); // NOTES: // 1. If property on a built in type && not assignment then just return the value of the property // 2. It's done here instead because there is no function/method call on a property. if (memberAccess.IsPropertyAccessOnBuiltInType()) { var result = FunctionHelper.CallMemberOnBasicType(this.Ctx, expr, memberAccess, null, null, this); return result; } if (memberAccess.IsPropertyAccessOnClass() || memberAccess.IsFieldAccessOnClass()) { var result = FunctionHelper.CallMemberOnClass(this.Ctx, expr, memberAccess, null, null, this); return result; } if (memberAccess.IsModuleAccess()) { var result = MemberHelper.ResolveSymbol(memberAccess.Scope, expr.MemberName); return result; } return memberAccess; }
/// <summary> /// Creates a function call expression. /// </summary> /// <param name="nameExpr"></param> /// <param name="parameters"></param> /// <param name="token"></param> /// <returns></returns> public static Expr MemberAccess(Expr nameExpr, string memberName, bool isAssignment, TokenData token) { var exp = new MemberAccessExpr(); exp.IsAssignment = isAssignment; exp.VarExp = nameExpr; exp.MemberName = memberName; SetupContext(exp, token); return exp; }
/// <summary> /// Visits the function call expression tree /// </summary> /// <param name="exp"></param> public object VisitMemberAccess(MemberAccessExpr exp) { return null; }