Search in sources :

Example 6 with MethodKey

use of org.elasticsearch.painless.Definition.MethodKey in project elasticsearch by elastic.

the class NodeToStringTests method testPSubShortcut.

public void testPSubShortcut() {
    Location l = new Location(getTestName(), 0);
    Struct s = Definition.getType(FeatureTest.class.getName()).struct;
    Method getter = s.methods.get(new MethodKey("getX", 0));
    Method setter = s.methods.get(new MethodKey("setX", 1));
    PSubShortcut node = new PSubShortcut(l, "x", FeatureTest.class.getName(), getter, setter);
    node.prefix = new EVariable(l, "a");
    assertEquals("(PSubShortcut (EVariable a) x)", node.toString());
    assertEquals("(PSubNullSafeCallInvoke (PSubShortcut (EVariable a) x))", new PSubNullSafeCallInvoke(l, node).toString());
}
Also used : FeatureTest(org.elasticsearch.painless.FeatureTest) Method(org.elasticsearch.painless.Definition.Method) Location(org.elasticsearch.painless.Location) Struct(org.elasticsearch.painless.Definition.Struct) MethodKey(org.elasticsearch.painless.Definition.MethodKey)

Aggregations

MethodKey (org.elasticsearch.painless.Definition.MethodKey)6 Method (org.elasticsearch.painless.Definition.Method)5 Struct (org.elasticsearch.painless.Definition.Struct)2 Location (org.elasticsearch.painless.Location)2 HashMap (java.util.HashMap)1 RuntimeClass (org.elasticsearch.painless.Definition.RuntimeClass)1 FeatureTest (org.elasticsearch.painless.FeatureTest)1 FunctionRef (org.elasticsearch.painless.FunctionRef)1