public void parsesMemberExpression() { String statement = "p.name"; OTestParser parser = new OTestParser(statement); IExpression e = parser.parse_instance_expression(); Assert.IsTrue(e is MemberSelector); MemberSelector me = (MemberSelector)e; Assert.AreEqual("name", me.getName()); Assert.IsTrue(me.getParent() is InstanceExpression); InstanceExpression uie = (InstanceExpression)me.getParent(); Assert.AreEqual("p", uie.getName()); }
private IExpression resolveMemberSelector(Context context, MemberSelector caller) { IExpression parent = caller.getParent(); String name = caller.getName(); return(new MethodCall(new MethodSelector(parent, name), arguments)); }