diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/MethodWriter.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/MethodWriter.java index e0a780d418843..5db7c6b3f712c 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/MethodWriter.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/MethodWriter.java @@ -227,14 +227,6 @@ public static Type getType(Class clazz) { return Type.getType(clazz); } - public void writeBranch(final Label tru, final Label fals) { - if (tru != null) { - visitJumpInsn(Opcodes.IFNE, tru); - } else if (fals != null) { - visitJumpInsn(Opcodes.IFEQ, fals); - } - } - /** Starts a new string concat. * @return the size of arguments pushed to stack (the object that does string concats, e.g. a StringBuilder) */ diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/antlr/StashingTokenFactory.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/antlr/StashingTokenFactory.java deleted file mode 100644 index 3ac45705d5549..0000000000000 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/antlr/StashingTokenFactory.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.painless.antlr; - -import org.antlr.v4.runtime.CharStream; -import org.antlr.v4.runtime.Lexer; -import org.antlr.v4.runtime.Token; -import org.antlr.v4.runtime.TokenFactory; -import org.antlr.v4.runtime.TokenSource; -import org.antlr.v4.runtime.misc.Pair; - -/** - * Token factory that preserves that last non-whitespace token so you can do token level lookbehind in the lexer. - */ -public class StashingTokenFactory implements TokenFactory { - private final TokenFactory delegate; - - private T lastToken; - - public StashingTokenFactory(TokenFactory delegate) { - this.delegate = delegate; - } - - public T getLastToken() { - return lastToken; - } - - @Override - public T create(Pair source, int type, String text, int channel, int start, int stop, int line, - int charPositionInLine) { - return maybeStash(delegate.create(source, type, text, channel, start, stop, line, charPositionInLine)); - } - - @Override - public T create(int type, String text) { - return maybeStash(delegate.create(type, text)); - } - - private T maybeStash(T token) { - if (token.getChannel() == Lexer.DEFAULT_TOKEN_CHANNEL) { - lastToken = token; - } - return token; - } -}