Skip to content

Commit 69b998a

Browse files
committed
Cleanup Methodwriter
1 parent 52b720d commit 69b998a

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

modules/lang-painless/src/main/java/org/elasticsearch/painless/MethodWriter.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,15 @@
104104
public final class MethodWriter extends GeneratorAdapter {
105105
private final BitSet statements;
106106
private final CompilerSettings settings;
107-
private final ScriptClassInfo scriptClassInfo;
108107

109108
private final Deque<List<Type>> stringConcatArgs =
110109
(INDY_STRING_CONCAT_BOOTSTRAP_HANDLE == null) ? null : new ArrayDeque<>();
111110

112-
public MethodWriter(int access, Method method, ClassVisitor cw, BitSet statements, ScriptClassInfo scriptClassInfo,
113-
CompilerSettings settings) {
111+
public MethodWriter(int access, Method method, ClassVisitor cw, BitSet statements, CompilerSettings settings) {
114112
super(Opcodes.ASM5, cw.visitMethod(access, method.getName(), method.getDescriptor(), null, null),
115113
access, method.getName(), method.getDescriptor());
116114

117115
this.statements = statements;
118-
this.scriptClassInfo = scriptClassInfo;
119116
this.settings = settings;
120117
}
121118

modules/lang-painless/src/main/java/org/elasticsearch/painless/phase/PainlessSemanticAnalysisPhase.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ public void visitFunction(SFunction userFunctionNode, ScriptScope scriptScope) {
106106
* Visits an expression that is also considered a statement.
107107
* Checks: control flow, type validation
108108
*
109-
* @param userExpressionNode
110-
* @param semanticScope
111109
*/
112110
@Override
113111
public void visitExpression(SExpression userExpressionNode, SemanticScope semanticScope) {
@@ -143,9 +141,7 @@ public void visitExpression(SExpression userExpressionNode, SemanticScope semant
143141
* Visits a return statement and casts the value to the return type if possible.
144142
* TODO(stu): rewrite
145143
* Checks: type validation
146-
*
147-
* @param userReturnNode
148-
* @param semanticScope
144+
149145
*/
150146
@Override
151147
public void visitReturn(SReturn userReturnNode, SemanticScope semanticScope) {

modules/lang-painless/src/test/java/org/elasticsearch/painless/FactoryTests.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,11 @@ public interface Factory {
295295
}
296296

297297
public static final ScriptContext<FactoryTestConverterScript.Factory> CONTEXT =
298-
new ScriptContext<>("test", FactoryTestScript.Factory.class);
298+
new ScriptContext<>("test", FactoryTestConverterScript.Factory.class);
299+
300+
public long[] convertFromInt(int i) {
301+
return new long[]{i};
302+
}
299303
}
300304

301305

@@ -305,9 +309,12 @@ public void testConverterFactory() {
305309
FactoryTestConverterScript script = factory.newInstance(Collections.singletonMap("test", 2));
306310
assertEquals(new long[]{2}, script.execute(2));
307311
script = factory.newInstance(Collections.singletonMap("test", 3));
308-
assertEquals(new long[]{3}, script.execute(2));
312+
assertEquals(new long[]{3}, script.execute(3));
309313

310314
factory = scriptEngine.compile("factory_test", "return test + 1;", FactoryTestConverterScript.CONTEXT, Collections.emptyMap());
311315
assertEquals(new long[]{1001}, script.execute(1000));
316+
317+
// TODO(stu): different conversion
318+
// TODO(stu): return long array
312319
}
313320
}

0 commit comments

Comments
 (0)