Skip to content
Snippets Groups Projects
Commit f2796519 authored by René Schöne's avatar René Schöne
Browse files

WIP dumpAst 0.3.1

- ignored types still leave "path to ancestors objects"
parent b50b459e
Branches
No related tags found
No related merge requests found
Pipeline #7863 passed
...@@ -2,7 +2,7 @@ DumpAst ::= DumpNode* <PackageName> BuildConfig PrintConfig ; ...@@ -2,7 +2,7 @@ DumpAst ::= DumpNode* <PackageName> BuildConfig PrintConfig ;
BuildConfig ::= <TypeIgnore> <TokenIgnore> <ChildIgnore> <AttributeIgnore> <RelationIgnore> <IncludeEmptyString:boolean> <Debug:boolean> ; BuildConfig ::= <TypeIgnore> <TokenIgnore> <ChildIgnore> <AttributeIgnore> <RelationIgnore> <IncludeEmptyString:boolean> <Debug:boolean> ;
PrintConfig ::= <Scale:double> <Version> Header* ; PrintConfig ::= <Scale:double> <Version> Header* ;
Header ::= <Value> ; Header ::= <Value> ;
DumpNode ::= <Name> <Label> <Object:Object> DumpChildNode* DumpToken* DumpRelation* ; DumpNode ::= <Name> <Label> <Object:Object> <Invisible:boolean> DumpChildNode* DumpToken* DumpRelation* /InvisiblePath/ ;
InnerDumpNode ; InnerDumpNode ;
rel InnerDumpNode.DumpNode -> DumpNode ; rel InnerDumpNode.DumpNode -> DumpNode ;
...@@ -20,3 +20,6 @@ abstract DumpRelation ::= <Name> <Bidirectional:boolean> ; ...@@ -20,3 +20,6 @@ abstract DumpRelation ::= <Name> <Bidirectional:boolean> ;
DumpNormalRelation : DumpRelation ; DumpNormalRelation : DumpRelation ;
rel DumpNormalRelation.DumpNode -> DumpNode ; rel DumpNormalRelation.DumpNode -> DumpNode ;
DumpListRelation : DumpRelation ::= InnerDumpNode* ; DumpListRelation : DumpRelation ::= InnerDumpNode* ;
// type of NTA
InvisiblePath ::= InnerDumpNode* ;
...@@ -54,6 +54,7 @@ import java.lang.String;aspect GenerationFrontend { ...@@ -54,6 +54,7 @@ import java.lang.String;aspect GenerationFrontend {
/** /**
* Exclude object with types matching at least one of the given regex strings. * Exclude object with types matching at least one of the given regex strings.
* Exlcuding object won't be included in any output. However, their children are still processed.
* @param regexes patterns to match type names * @param regexes patterns to match type names
* @return this * @return this
* @see java.util.regex.Pattern#compile(java.lang.String) * @see java.util.regex.Pattern#compile(java.lang.String)
...@@ -166,16 +167,17 @@ aspect GenerationBackend { ...@@ -166,16 +167,17 @@ aspect GenerationBackend {
if (tti.transformed.containsKey(obj)) { if (tti.transformed.containsKey(obj)) {
return tti.transformed.get(obj); return tti.transformed.get(obj);
} }
if (matches(getBuildConfig().typeIgnorePattern(), obj.getClass().getSimpleName())) { // tti.transformed.put(obj, null);
tti.transformed.put(obj, null); // return null;
return null;
}
DumpNode node = new DumpNode(); DumpNode node = new DumpNode();
node.setObject(obj); node.setObject(obj);
node.setLabel(obj.getClass().getSimpleName() + "@" + obj.hashCode()); node.setLabel(obj.getClass().getSimpleName() + "@" + obj.hashCode());
node.setName("node" + tti.transformed.size()); node.setName("node" + tti.transformed.size());
tti.transformed.put(obj, node); tti.transformed.put(obj, node);
this.addDumpNode(node); this.addDumpNode(node);
if (matches(getBuildConfig().typeIgnorePattern(), obj.getClass().getSimpleName())) {
node.setInvisible(true);
}
if (node.isAstNode()) { if (node.isAstNode()) {
// only caching node.analyseClass does not help, since we want to do this only once per class of a node // only caching node.analyseClass does not help, since we want to do this only once per class of a node
final ClassAnalysisResult car; final ClassAnalysisResult car;
...@@ -370,6 +372,7 @@ aspect GenerationBackend { ...@@ -370,6 +372,7 @@ aspect GenerationBackend {
return (String) annotation.annotationType().getMethod("name").invoke(annotation); return (String) annotation.annotationType().getMethod("name").invoke(annotation);
} }
// --- isAstNode ---
syn boolean DumpNode.isAstNode() { syn boolean DumpNode.isAstNode() {
Class<?> clazz = getObject().getClass(); Class<?> clazz = getObject().getClass();
for (java.lang.reflect.Constructor<?> constructor : clazz.getConstructors()) { for (java.lang.reflect.Constructor<?> constructor : clazz.getConstructors()) {
...@@ -383,9 +386,34 @@ aspect GenerationBackend { ...@@ -383,9 +386,34 @@ aspect GenerationBackend {
return false; return false;
} }
// --- astNodeAnnotationPrefix ---
inh String DumpNode.astNodeAnnotationPrefix(); inh String DumpNode.astNodeAnnotationPrefix();
eq DumpAst.getDumpNode().astNodeAnnotationPrefix() = getPackageName() + ".ASTNodeAnnotation"; eq DumpAst.getDumpNode().astNodeAnnotationPrefix() = getPackageName() + ".ASTNodeAnnotation";
// --- NTA: InvisiblePath ---
syn InvisiblePath DumpNode.getInvisiblePath() {
InvisiblePath result = new InvisiblePath();
for (DumpNode successor : reachableThroughInvisible()) {
result.addInnerDumpNode(new InnerDumpNode(successor));
}
return result;
}
// --- reachableThroughInvisible ---
syn java.util.List<DumpNode> DumpNode.reachableThroughInvisible() {
java.util.List<DumpNode> result = new java.util.ArrayList<>();
for (DumpChildNode childNode : getDumpChildNodeList()) {
for (DumpNode inner : childNode.innerNodes(false)) {
if (inner.getInvisible()) {
result.addAll(inner.reachableThroughInvisible());
} else if (this.getInvisible()) {
result.add(inner);
}
}
}
return result;
}
class TransformationTransferInformation { class TransformationTransferInformation {
java.util.Map<Object, DumpNode> transformed = new java.util.HashMap<>(); java.util.Map<Object, DumpNode> transformed = new java.util.HashMap<>();
java.util.Map<Class<?>, ClassAnalysisResult> classAnalysisResults = new java.util.HashMap<>(); java.util.Map<Class<?>, ClassAnalysisResult> classAnalysisResults = new java.util.HashMap<>();
......
...@@ -20,4 +20,50 @@ aspect Navigation { ...@@ -20,4 +20,50 @@ aspect Navigation {
// --- printConfig --- // --- printConfig ---
inh PrintConfig BuildConfig.printConfig(); inh PrintConfig BuildConfig.printConfig();
eq DumpAst.getChild().printConfig() = getPrintConfig(); eq DumpAst.getChild().printConfig() = getPrintConfig();
// --- containingDumpNode ---
inh DumpNode InnerDumpNode.containingDumpNode();
inh DumpNode DumpChildNode.containingDumpNode();
inh DumpNode DumpRelation.containingDumpNode();
eq DumpNode.getDumpChildNode().containingDumpNode() = this;
eq DumpNode.getDumpRelation().containingDumpNode() = this;
eq DumpNode.getInvisiblePath().containingDumpNode() = this;
// --- innerVisibleNodes ---
syn java.util.List<DumpNode> DumpChildNode.innerVisibleNodes() = innerNodes(true);
syn java.util.List<DumpNode> DumpRelation.innerVisibleNodes() = innerNodes(true);
// --- innerNodes ---
syn java.util.List<DumpNode> DumpChildNode.innerNodes(boolean onlyVisible);
eq DumpNormalChildNode.innerNodes(boolean onlyVisible) = onlyVisible && (containingDumpNode().getInvisible() || getDumpNode().getInvisible()) ?
java.util.Collections.emptyList() :
java.util.Collections.singletonList(getDumpNode());
eq DumpListChildNode.innerNodes(boolean onlyVisible) {
if (onlyVisible && containingDumpNode().getInvisible()) {
return java.util.Collections.emptyList();
}
java.util.List<DumpNode> result = new java.util.ArrayList<>();
getInnerDumpNodeList().forEach(inner -> {
if (!onlyVisible || !inner.getDumpNode().getInvisible()) {
result.add(inner.getDumpNode());
}
});
return result;
}
syn java.util.List<DumpNode> DumpRelation.innerNodes(boolean onlyVisible);
eq DumpNormalRelation.innerNodes(boolean onlyVisible) = onlyVisible && (containingDumpNode().getInvisible() || getDumpNode().getInvisible()) ?
java.util.Collections.emptyList() :
java.util.Collections.singletonList(getDumpNode());
eq DumpListRelation.innerNodes(boolean onlyVisible) {
if (onlyVisible && containingDumpNode().getInvisible()) {
return java.util.Collections.emptyList();
}
java.util.List<DumpNode> result = new java.util.ArrayList<>();
getInnerDumpNodeList().forEach(inner -> {
if (!onlyVisible || !inner.getDumpNode().getInvisible()) {
result.add(inner.getDumpNode());
}
});
return result;
}
} }
...@@ -20,4 +20,9 @@ aspect Printing { ...@@ -20,4 +20,9 @@ aspect Printing {
syn String DumpRelation.label() = getName(); syn String DumpRelation.label() = getName();
syn String DumpToken.label() = getName(); syn String DumpToken.label() = getName();
syn String DumpNode.label() = getLabel(); syn String DumpNode.label() = getLabel();
// --- bothVisible ---
syn boolean InnerDumpNode.bothVisible() = !containingDumpNode().getInvisible() && !getDumpNode().getInvisible();
syn boolean DumpNormalChildNode.bothVisible() = !containingDumpNode().getInvisible() && !getDumpNode().getInvisible();
syn boolean DumpNormalRelation.bothVisible() = !containingDumpNode().getInvisible() && !getDumpNode().getInvisible();
} }
...@@ -8,6 +8,7 @@ scale {{Scale}} ...@@ -8,6 +8,7 @@ scale {{Scale}}
{{#DumpNodes}} {{#DumpNodes}}
{{#isAstNode}} {{#isAstNode}}
{{^Invisible}}
object "{{label}}" as {{name}} { object "{{label}}" as {{name}} {
{{#DumpTokens}} {{#DumpTokens}}
{{#isDumpValueToken}} {{#isDumpValueToken}}
...@@ -15,35 +16,53 @@ object "{{label}}" as {{name}} { ...@@ -15,35 +16,53 @@ object "{{label}}" as {{name}} {
{{/isDumpValueToken}} {{/isDumpValueToken}}
{{/DumpTokens}} {{/DumpTokens}}
} }
{{/Invisible}}
{{/isAstNode}} {{/isAstNode}}
{{/DumpNodes}} {{/DumpNodes}}
{{#DumpNodes}} {{#DumpNodes}}
{{#DumpTokens}} {{#DumpTokens}}
{{^Invisible}}
{{^isDumpValueToken}} {{^isDumpValueToken}}
{{outerNodeName}} ..> {{innerNodeName}} : {{label}} {{outerNodeName}} ..> {{innerNodeName}} : {{label}}
{{/isDumpValueToken}} {{/isDumpValueToken}}
{{/Invisible}}
{{/DumpTokens}} {{/DumpTokens}}
{{#DumpChildNodes}} {{#DumpChildNodes}}
{{#isList}} {{#isList}}
{{#InnerDumpNodes}} {{#InnerDumpNodes}}
{{#bothVisible}}
{{outerNodeName}} *-- {{innerNodeName}} : {{label}} {{outerNodeName}} *-- {{innerNodeName}} : {{label}}
{{/bothVisible}}
{{/InnerDumpNodes}} {{/InnerDumpNodes}}
{{/isList}} {{/isList}}
{{^isList}} {{^isList}}
{{#bothVisible}}
{{outerNodeName}} *-- {{innerNodeName}} : {{label}} {{outerNodeName}} *-- {{innerNodeName}} : {{label}}
{{/bothVisible}}
{{/isList}} {{/isList}}
{{/DumpChildNodes}} {{/DumpChildNodes}}
{{#DumpRelations}} {{#DumpRelations}}
{{#isList}} {{#isList}}
{{#InnerDumpNodes}} {{#InnerDumpNodes}}
{{#bothVisible}}
{{outerNodeName}} {{#Bidirectional}}<{{/Bidirectional}}--> {{innerNodeName}} : {{label}} {{outerNodeName}} {{#Bidirectional}}<{{/Bidirectional}}--> {{innerNodeName}} : {{label}}
{{/bothVisible}}
{{/InnerDumpNodes}} {{/InnerDumpNodes}}
{{/isList}} {{/isList}}
{{^isList}} {{^isList}}
{{#bothVisible}}
{{outerNodeName}} {{#Bidirectional}}<{{/Bidirectional}}--> {{innerNodeName}} : {{label}} {{outerNodeName}} {{#Bidirectional}}<{{/Bidirectional}}--> {{innerNodeName}} : {{label}}
{{/bothVisible}}
{{/isList}} {{/isList}}
{{/DumpRelations}} {{/DumpRelations}}
{{^Invisible}}
{{#InvisiblePath}}
{{#InnerDumpNodes}}
{{outerNodeName}} o.. {{innerNodeName}}
{{/InnerDumpNodes}}
{{/InvisiblePath}}
{{/Invisible}}
{{/DumpNodes}} {{/DumpNodes}}
{{#BuildConfig}} {{#BuildConfig}}
{{#Debug}} {{#Debug}}
......
...@@ -2,9 +2,13 @@ package de.tudresden.inf.st.jastadd.testDumper; ...@@ -2,9 +2,13 @@ package de.tudresden.inf.st.jastadd.testDumper;
import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpBuilder; import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpBuilder;
import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpNode; import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpNode;
import de.tudresden.inf.st.jastadd.dumpAst.ast.Dumper;
import org.jastadd.testDumper.ast.A;
import org.jastadd.testDumper.ast.Root; import org.jastadd.testDumper.ast.Root;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.List; import java.util.List;
import static de.tudresden.inf.st.jastadd.testDumper.TestUtils.*; import static de.tudresden.inf.st.jastadd.testDumper.TestUtils.*;
...@@ -65,11 +69,11 @@ public class TestExcluded { ...@@ -65,11 +69,11 @@ public class TestExcluded {
Root root = setupTypes(); Root root = setupTypes();
List<DumpNode> nodes = TestUtils.dumpModel(root); List<DumpNode> nodes = TestUtils.dumpModel(root);
assertThat(nodes).flatExtracting(NAME_EXTRACTOR).containsExactlyInAnyOrder(ROOT_NAME, A_NAME, B_NAME, C_NAME);
assertTypeDefaultMatches(nodes); assertTypeDefaultMatches(nodes);
} }
private void assertTypeDefaultMatches(List<DumpNode> nodes) { private void assertTypeDefaultMatches(List<DumpNode> nodes) {
assertThat(nodes).flatExtracting(NAME_EXTRACTOR).containsExactlyInAnyOrder(ROOT_NAME, A_NAME, B_NAME, C_NAME);
// A // A
assertThatMapOf(normalRelationChildren(findByName(nodes, A_NAME))).containsExactlyInAnyOrder( assertThatMapOf(normalRelationChildren(findByName(nodes, A_NAME))).containsExactlyInAnyOrder(
tuple("BiC1", C_NAME), tuple("BiC2", C_NAME), tuple("BiC3", C_NAME)); tuple("BiC1", C_NAME), tuple("BiC2", C_NAME), tuple("BiC3", C_NAME));
...@@ -89,6 +93,7 @@ public class TestExcluded { ...@@ -89,6 +93,7 @@ public class TestExcluded {
Root root = setupTypes(); Root root = setupTypes();
List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.excludeTypes("NonExistingType")); List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.excludeTypes("NonExistingType"));
assertThat(nodes).flatExtracting(NAME_EXTRACTOR).containsExactlyInAnyOrder(ROOT_NAME, A_NAME, B_NAME, C_NAME);
assertTypeDefaultMatches(nodes); assertTypeDefaultMatches(nodes);
} }
...@@ -97,6 +102,7 @@ public class TestExcluded { ...@@ -97,6 +102,7 @@ public class TestExcluded {
Root root = setupTypes(); Root root = setupTypes();
List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.excludeTypes("Nameable")); List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.excludeTypes("Nameable"));
assertThat(nodes).flatExtracting(NAME_EXTRACTOR).containsExactlyInAnyOrder(ROOT_NAME, A_NAME, B_NAME, C_NAME);
assertTypeDefaultMatches(nodes); assertTypeDefaultMatches(nodes);
} }
...@@ -135,6 +141,44 @@ public class TestExcluded { ...@@ -135,6 +141,44 @@ public class TestExcluded {
assertThatMapOf(normalRelationChildren(findByName(nodes, B_NAME))).isEmpty(); assertThatMapOf(normalRelationChildren(findByName(nodes, B_NAME))).isEmpty();
} }
@Test
public void testTypesExcludeRegex() {
Root root = setupTypes();
List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.excludeTypes("Ro*t"));
assertThat(nodes).flatExtracting(NAME_EXTRACTOR).containsExactlyInAnyOrder(A_NAME, B_NAME, C_NAME);
assertTypeDefaultMatches(nodes);
}
@Test
public void testTypesInvisiblePath() throws IOException {
final String A2_Name = "a2";
final String A3_Name = "a3";
final String C2_Name = "c2";
A mostInnerA = createA(A3_Name);
mostInnerA.setB(createB(B_NAME));
Root root = createRoot(createA(A_NAME,
createC(C_NAME,
createA(A2_Name,
createC(C2_Name, mostInnerA)))),
null);
List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.excludeTypes("A", "C"));
Dumper.read(root).excludeTypes("A", "C").dumpAsPNG(Paths.get("test.png"));
DumpNode actualRoot = findByName(nodes, ROOT_NAME);
assertThat(invisiblePath(actualRoot)).flatExtracting(NAME_EXTRACTOR).containsExactly(B_NAME);
}
@Test
public void testTokenDefault() {
}
@Test
public void testTokenExclude() {
}
// --- copy from below here --- // --- copy from below here ---
@Test @Test
......
...@@ -14,7 +14,7 @@ import java.util.*; ...@@ -14,7 +14,7 @@ import java.util.*;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Function; import java.util.function.Function;
import static org.assertj.core.api.Assertions.tuple; import static org.junit.jupiter.api.Assertions.assertFalse;
public class TestUtils { public class TestUtils {
public static final Random rand = new Random(); public static final Random rand = new Random();
...@@ -50,6 +50,13 @@ public class TestUtils { ...@@ -50,6 +50,13 @@ public class TestUtils {
return result; return result;
} }
public static A createA(String name, C myC) {
A result = new A();
result.setName(name);
result.setMyC(myC);
return result;
}
public static B createB(String name) { public static B createB(String name) {
B result = new B(); B result = new B();
result.setName(name); result.setName(name);
...@@ -69,8 +76,15 @@ public class TestUtils { ...@@ -69,8 +76,15 @@ public class TestUtils {
return result; return result;
} }
public static final Function<DumpNode, String> NAME_EXTRACTOR = dp -> { public static C createC(String name, A optA) {
for (DumpToken dumpToken : dp.getDumpTokenList()) { C result = new C();
result.setName(name);
result.setA(optA);
return result;
}
public static final Function<DumpNode, String> NAME_EXTRACTOR = node -> {
for (DumpToken dumpToken : node.getDumpTokenList()) {
if (dumpToken.getName().equals("Name")) { if (dumpToken.getName().equals("Name")) {
return dumpToken.asDumpValueToken().getValue().toString(); return dumpToken.asDumpValueToken().getValue().toString();
} }
...@@ -99,9 +113,11 @@ public class TestUtils { ...@@ -99,9 +113,11 @@ public class TestUtils {
ExposingDumpBuilder builder = new ExposingDumpBuilder(target); ExposingDumpBuilder builder = new ExposingDumpBuilder(target);
options.accept(builder); options.accept(builder);
DumpAst dumpAst = builder.build(); DumpAst dumpAst = builder.build();
// let mustache run, but ignore result
dumpAst.toPlantUml();
List<DumpNode> result = new ArrayList<>(); List<DumpNode> result = new ArrayList<>();
for (DumpNode dumpNode : dumpAst.getDumpNodeList()) { for (DumpNode dumpNode : dumpAst.getDumpNodeList()) {
if (dumpNode.isAstNode()) { if (dumpNode.isAstNode() && !dumpNode.getInvisible()) {
result.add(dumpNode); result.add(dumpNode);
} }
} }
...@@ -124,7 +140,10 @@ public class TestUtils { ...@@ -124,7 +140,10 @@ public class TestUtils {
for (DumpChildNode dumpChildNode : node.getDumpChildNodeList()) { for (DumpChildNode dumpChildNode : node.getDumpChildNodeList()) {
if (!dumpChildNode.isList()) { if (!dumpChildNode.isList()) {
// then it is a DumpNormalChildNode // then it is a DumpNormalChildNode
result.put(dumpChildNode.label(), ((DumpNormalChildNode) dumpChildNode).getDumpNode()); DumpNode target = ((DumpNormalChildNode) dumpChildNode).getDumpNode();
if (!target.getInvisible()) {
result.put(dumpChildNode.label(), target);
}
} }
} }
return result; return result;
...@@ -135,8 +154,11 @@ public class TestUtils { ...@@ -135,8 +154,11 @@ public class TestUtils {
for (DumpChildNode dumpChildNode : node.getDumpChildNodeList()) { for (DumpChildNode dumpChildNode : node.getDumpChildNodeList()) {
if (dumpChildNode.isList()) { if (dumpChildNode.isList()) {
// then it is a DumpListChildNode // then it is a DumpListChildNode
((DumpListChildNode) dumpChildNode).getInnerDumpNodeList().forEach(inner -> ((DumpListChildNode) dumpChildNode).getInnerDumpNodeList().forEach(inner -> {
result.computeIfAbsent(dumpChildNode.label(), key -> new ArrayList<>()).add(inner.getDumpNode())); if (!inner.getDumpNode().getInvisible()) {
result.computeIfAbsent(dumpChildNode.label(), key -> new ArrayList<>()).add(inner.getDumpNode());
}
});
} }
} }
return result; return result;
...@@ -147,7 +169,10 @@ public class TestUtils { ...@@ -147,7 +169,10 @@ public class TestUtils {
for (DumpRelation dumpRelation : node.getDumpRelationList()) { for (DumpRelation dumpRelation : node.getDumpRelationList()) {
if (!dumpRelation.isList()) { if (!dumpRelation.isList()) {
// then it is a DumpNormalRelation // then it is a DumpNormalRelation
result.put(dumpRelation.label(), ((DumpNormalRelation) dumpRelation).getDumpNode()); DumpNode target = ((DumpNormalRelation) dumpRelation).getDumpNode();
if (!target.getInvisible()) {
result.put(dumpRelation.label(), target);
}
} }
} }
return result; return result;
...@@ -158,8 +183,11 @@ public class TestUtils { ...@@ -158,8 +183,11 @@ public class TestUtils {
for (DumpRelation dumpRelation : node.getDumpRelationList()) { for (DumpRelation dumpRelation : node.getDumpRelationList()) {
if (dumpRelation.isList()) { if (dumpRelation.isList()) {
// then it is a DumpListRelation // then it is a DumpListRelation
((DumpListRelation) dumpRelation).getInnerDumpNodeList().forEach( ((DumpListRelation) dumpRelation).getInnerDumpNodeList().forEach(inner -> {
inner -> result.computeIfAbsent(dumpRelation.label(), key -> new ArrayList<>()).add(inner.getDumpNode())); if (!inner.getDumpNode().getInvisible()) {
result.computeIfAbsent(dumpRelation.label(), key -> new ArrayList<>()).add(inner.getDumpNode());
}
});
} }
} }
return result; return result;
...@@ -170,7 +198,10 @@ public class TestUtils { ...@@ -170,7 +198,10 @@ public class TestUtils {
for (DumpToken dumpToken : node.getDumpTokenList()) { for (DumpToken dumpToken : node.getDumpTokenList()) {
if (!dumpToken.isDumpValueToken()) { if (!dumpToken.isDumpValueToken()) {
// then it is a DumpReferenceToken // then it is a DumpReferenceToken
result.put(dumpToken.label(), ((DumpReferenceToken) dumpToken).getValue()); DumpNode target = ((DumpReferenceToken) dumpToken).getValue();
if (!target.getInvisible()) {
result.put(dumpToken.label(), target);
}
} }
} }
return result; return result;
...@@ -188,6 +219,16 @@ public class TestUtils { ...@@ -188,6 +219,16 @@ public class TestUtils {
return result; return result;
} }
public static List<DumpNode> invisiblePath(DumpNode node) {
List<DumpNode> result = new ArrayList<>();
for (InnerDumpNode inner : node.getInvisiblePath().getInnerDumpNodeList()) {
DumpNode target = inner.getDumpNode();
assertFalse(target.getInvisible());
result.add(target);
}
return result;
}
static class ExposingDumpBuilder extends DumpBuilder { static class ExposingDumpBuilder extends DumpBuilder {
protected ExposingDumpBuilder(Object target) { protected ExposingDumpBuilder(Object target) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment