mirror of
https://github.com/lightbend/config.git
synced 2025-02-15 05:40:40 +08:00
Change parent class of ConfigNodeInclude
Modify the parent class of ConfigNodeInclude to be AbstractConfigNode instead of ConfigNodeComplexValue, as an include statement is not a value.
This commit is contained in:
parent
dc567e8489
commit
deb32bcab0
@ -35,10 +35,10 @@ abstract class ConfigNodeComplexValue extends AbstractConfigNodeValue {
|
||||
i++;
|
||||
} else if (child instanceof ConfigNodeField) {
|
||||
AbstractConfigNode value = ((ConfigNodeField) child).value();
|
||||
if (value instanceof ConfigNodeComplexValue && !(value instanceof ConfigNodeInclude)) {
|
||||
if (value instanceof ConfigNodeComplexValue) {
|
||||
childrenCopy.set(i, ((ConfigNodeField) child).replaceValue(((ConfigNodeComplexValue) value).indentText(indentation)));
|
||||
}
|
||||
} else if (child instanceof ConfigNodeComplexValue && !(child instanceof ConfigNodeInclude)) {
|
||||
} else if (child instanceof ConfigNodeComplexValue) {
|
||||
childrenCopy.set(i, ((ConfigNodeComplexValue) child).indentText(indentation));
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,28 @@
|
||||
package com.typesafe.config.impl;
|
||||
|
||||
import com.typesafe.config.ConfigException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
final class ConfigNodeInclude extends ConfigNodeComplexValue {
|
||||
final class ConfigNodeInclude extends AbstractConfigNode {
|
||||
final private ArrayList<AbstractConfigNode> children;
|
||||
final private ConfigIncludeKind kind;
|
||||
|
||||
ConfigNodeInclude(Collection<AbstractConfigNode> children, ConfigIncludeKind kind) {
|
||||
super(children);
|
||||
this.children = new ArrayList<AbstractConfigNode>(children);
|
||||
this.kind = kind;
|
||||
}
|
||||
|
||||
final public Collection<AbstractConfigNode> children() {
|
||||
return children;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ConfigNodeInclude newNode(Collection<AbstractConfigNode> nodes) {
|
||||
throw new ConfigException.BugOrBroken("Tried to indent an include node");
|
||||
protected Collection<Token> tokens() {
|
||||
ArrayList<Token> tokens = new ArrayList();
|
||||
for (AbstractConfigNode child : children) {
|
||||
tokens.addAll(child.tokens());
|
||||
}
|
||||
return tokens;
|
||||
}
|
||||
|
||||
protected ConfigIncludeKind kind() {
|
||||
|
@ -270,7 +270,6 @@ final class ConfigParser {
|
||||
valueNode = ((ConfigNodeField) node).value();
|
||||
|
||||
// comments from the key token go to the value token
|
||||
//newValue = parseValue(valueToken.prepend(keyToken.comments));
|
||||
newValue = parseValue(valueNode, comments);
|
||||
|
||||
if (((ConfigNodeField) node).separator() == Tokens.PLUS_EQUALS) {
|
||||
|
Loading…
Reference in New Issue
Block a user