forked from phoedos/pmd
Build sized array initializers
This commit is contained in:
Edward Klimoshenko
committed by
Aaron Hurst
parent
3b609c5450
commit
543a1117cd
@ -6,14 +6,14 @@ package net.sourceforge.pmd.lang.apex.ast;
|
||||
|
||||
import net.sourceforge.pmd.annotation.InternalApi;
|
||||
|
||||
import com.google.summit.ast.initializer.ConstructorInitializer;
|
||||
import com.google.summit.ast.initializer.Initializer;
|
||||
|
||||
public class ASTNewListInitExpression extends AbstractApexNode.Single<ConstructorInitializer> {
|
||||
public class ASTNewListInitExpression extends AbstractApexNode.Single<Initializer> {
|
||||
|
||||
@Deprecated
|
||||
@InternalApi
|
||||
public ASTNewListInitExpression(ConstructorInitializer constructorInitializer) {
|
||||
super(constructorInitializer);
|
||||
public ASTNewListInitExpression(Initializer initializer) {
|
||||
super(initializer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,6 +38,7 @@ import com.google.summit.ast.expression.UnaryExpression
|
||||
import com.google.summit.ast.expression.VariableExpression
|
||||
import com.google.summit.ast.initializer.ConstructorInitializer
|
||||
import com.google.summit.ast.initializer.MapInitializer
|
||||
import com.google.summit.ast.initializer.SizedArrayInitializer
|
||||
import com.google.summit.ast.initializer.ValuesInitializer
|
||||
import com.google.summit.ast.modifier.KeywordModifier
|
||||
import com.google.summit.ast.modifier.KeywordModifier.Keyword
|
||||
@ -114,6 +115,7 @@ class ApexTreeBuilder(val sourceCode: String, val parserOptions: ApexParserOptio
|
||||
is ConstructorInitializer -> buildConstructorInitializer(node)
|
||||
is ValuesInitializer -> buildValuesInitializer(node)
|
||||
is MapInitializer -> buildMapInitializer(node)
|
||||
is SizedArrayInitializer -> buildSizedArrayInitializer(node)
|
||||
is Identifier,
|
||||
is KeywordModifier,
|
||||
is TypeRef -> null
|
||||
@ -414,6 +416,10 @@ class ApexTreeBuilder(val sourceCode: String, val parserOptions: ApexParserOptio
|
||||
node.pairs.forEach { pair -> buildMapEntry(pair).also { it.setParent(this) } }
|
||||
}
|
||||
|
||||
/** Builds an [ASTNewListInitExpression] wrapper for the [SizedArrayInitializer]. */
|
||||
private fun buildSizedArrayInitializer(node: SizedArrayInitializer) =
|
||||
ASTNewListInitExpression(node).apply { buildChildren(node, parent = this) }
|
||||
|
||||
/** Builds an [ASTStandardCondition] wrapper for the [condition]. */
|
||||
private fun buildCondition(condition: Node?) =
|
||||
ASTStandardCondition(condition).apply { buildAndSetParent(condition, this) }
|
||||
|
Reference in New Issue
Block a user