Skip to content
Snippets Groups Projects
Commit ccc3b081 authored by Emma Söderberg's avatar Emma Söderberg
Browse files

Adds dumping of cached values for collection attributes for incremental/debug.

parent aff42221
No related branches found
No related tags found
No related merge requests found
...@@ -39,6 +39,7 @@ aspect IncrementalDebug { ...@@ -39,6 +39,7 @@ aspect IncrementalDebug {
tt.expand("ASTDecl.printParamListMethod", out); tt.expand("ASTDecl.printParamListMethod", out);
tt.expand("ASTDecl.printValueMethod", out); tt.expand("ASTDecl.printValueMethod", out);
tt.bind("DumpAttributeValues", genDumpAttributeValuesString()); tt.bind("DumpAttributeValues", genDumpAttributeValuesString());
tt.bind("DumpCollAttributeValues", genDumpCollAttributeValuesString());
tt.expand("ASTDecl.dumpCachedValuesMethod", out); tt.expand("ASTDecl.dumpCachedValuesMethod", out);
tt.bind("DumpTokenDeps", genDumpTokenDepsString()); tt.bind("DumpTokenDeps", genDumpTokenDepsString());
tt.bind("DumpAttributeDeps", genDumpAttributeDepsString()); tt.bind("DumpAttributeDeps", genDumpAttributeDepsString());
...@@ -128,4 +129,18 @@ aspect IncrementalDebug { ...@@ -128,4 +129,18 @@ aspect IncrementalDebug {
} }
return res.toString(); return res.toString();
} }
/**
* Generate string with code for dumping collection attribute values.
*/
public String ASTDecl.genDumpCollAttributeValuesString() {
StringBuffer res = new StringBuffer();
TemplateContext tt = templateContext();
for (int k = 0; k < getNumCollDecl(); k++) {
CollDecl attr = getCollDecl(k);
tt.bind("AttrSign", attr.signature());
res.append(tt.expand("ASTDecl.dumpCollAttributeValue"));
}
return res.toString();
}
} }
...@@ -118,7 +118,7 @@ $endif ...@@ -118,7 +118,7 @@ $endif
ASTDecl.dumpCachedValuesMethod = [[ ASTDecl.dumpCachedValuesMethod = [[
public void #name.dumpCachedValues() { public void #name.dumpCachedValues() {
$DumpAttributeValues $DumpAttributeValues
// TODO: dump collection values $DumpCollAttributeValues
$if (!#isASTNodeDecl) $if (!#isASTNodeDecl)
super.dumpCachedValues(); super.dumpCachedValues();
$endif $endif
...@@ -151,6 +151,14 @@ $endif ...@@ -151,6 +151,14 @@ $endif
$endif $endif
]] ]]
# Generate code for dumping a collection attribute value.
# TODO: Add support for parameterized/NTA collection attributes.
ASTDecl.dumpCollAttributeValue = [[
if ($(AttrSign)_computed) {
System.out.println("value(" + relativeNodeID() + ":$(AttrSign), " + $(AttrSign)_value + ")");
}
]]
# Generate code for method dumping dependencies # Generate code for method dumping dependencies
ASTDecl.dumpDependenciesMethod = [[ ASTDecl.dumpDependenciesMethod = [[
private boolean #name.inc_dumpDependencies_visited = false; private boolean #name.inc_dumpDependencies_visited = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment