Replace Node#apply(List<Node>) with apply(Node)
This commit is contained in:
@ -4,8 +4,6 @@
|
||||
|
||||
package net.sourceforge.pmd.lang.ecmascript.rule;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.pmd.RuleContext;
|
||||
import net.sourceforge.pmd.lang.LanguageRegistry;
|
||||
import net.sourceforge.pmd.lang.ParserOptions;
|
||||
@ -40,16 +38,10 @@ public abstract class AbstractEcmascriptRule extends AbstractRule
|
||||
return new EcmascriptParserOptions(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(List<? extends Node> nodes, RuleContext ctx) {
|
||||
visitAll(nodes, ctx);
|
||||
}
|
||||
|
||||
protected void visitAll(List<? extends Node> nodes, RuleContext ctx) {
|
||||
for (Object element : nodes) {
|
||||
ASTAstRoot node = (ASTAstRoot) element;
|
||||
visit(node, ctx);
|
||||
}
|
||||
@Override
|
||||
public void apply(Node target, RuleContext ctx) {
|
||||
((EcmascriptNode<?>) target).jjtAccept(this, ctx);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
@ -66,7 +65,7 @@ public class EcmascriptParserTest extends EcmascriptParserTestBase {
|
||||
|
||||
MyEcmascriptRule rule = new MyEcmascriptRule();
|
||||
RuleContext ctx = new RuleContext();
|
||||
rule.apply(Arrays.asList(js.parse(source)), ctx);
|
||||
rule.apply(js.parse(source), ctx);
|
||||
|
||||
assertEquals("Scope from 2 to 4", output.get(0));
|
||||
assertEquals("Scope from 4 to 6", output.get(1));
|
||||
|
Reference in New Issue
Block a user