hack
This commit is contained in:
parent
02cf429e53
commit
546aed8390
|
@ -0,0 +1,5 @@
|
|||
package org.elasticsearch.painless;
|
||||
|
||||
/** Marker interface that a generated {@link Executable} uses the {@code _score} value */
|
||||
public interface NeedsScore {
|
||||
}
|
|
@ -135,7 +135,14 @@ class Writer extends PainlessParserBaseVisitor<Void> {
|
|||
final String base = BASE_CLASS_TYPE.getInternalName();
|
||||
final String name = CLASS_TYPE.getInternalName();
|
||||
|
||||
writer.visit(version, access, name, null, base, null);
|
||||
// apply marker interface NeedsScore if we use the score!
|
||||
final String interfaces[];
|
||||
if (metadata.scoreValueUsed) {
|
||||
interfaces = new String[] { WriterConstants.NEEDS_SCORE_TYPE.getInternalName() };
|
||||
} else {
|
||||
interfaces = null;
|
||||
}
|
||||
writer.visit(version, access, name, null, base, interfaces);
|
||||
writer.visitSource(source, null);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ class WriterConstants {
|
|||
final static Type PAINLESS_ERROR_TYPE = Type.getType(PainlessError.class);
|
||||
|
||||
final static Type DEFINITION_TYPE = Type.getType(Definition.class);
|
||||
|
||||
final static Type NEEDS_SCORE_TYPE = Type.getType(NeedsScore.class);
|
||||
|
||||
final static Type OBJECT_TYPE = Type.getType(Object.class);
|
||||
|
||||
|
|
Loading…
Reference in New Issue