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

Adds flushing of collection attributes for incremental/param.

parent ccc3b081
Branches
No related tags found
No related merge requests found
......@@ -42,6 +42,7 @@
tt.expand("ASTDecl.incValueAffectedMethod", out);
tt.bind("AttrFlushChecks", emitAttrFlushChecksString());
tt.bind("CollAttrFlushChecks", emitCollAttrFlushChecksString());
tt.expand("ASTDecl.incReactToDepChangeMethod", out);
tt.bind("FlushAttrs", emitFlushAttrsString());
......@@ -206,6 +207,31 @@
return res.toString();
}
/**
* Creates string with code checking if a collection attribute should be
* flushed and dependencies notified.
*/
public String ASTDecl.emitCollAttrFlushChecksString() {
if (config().incrementalLevelNode() || config().incrementalLevelRegion()) {
return "";
}
StringBuffer res = new StringBuffer();
TemplateContext tt = templateContext();
boolean firstAttr = true;
for (int k = 0; k < getNumCollDecl(); k++) {
CollDecl attr = getCollDecl(k);
res.append(firstAttr ? "" : "else ");
tt.bind("AttrSign", attr.signature());
tt.bind("AttrType", attr.type());
tt.bind("AttrResetVisit", attr.resetVisit());
tt.bind("AttrResetCache", attr.resetCache());
tt.bind("CollectionReset", collectionReset());
res.append(tt.expand("ASTDecl.collAttrFlushCheck"));
firstAttr = false;
}
return res.toString();
}
/**
* Creates string with code flushing attributes.
*/
......
......@@ -176,9 +176,9 @@ $endif
ASTDecl.incChangeFlush = [[
$if(IncrementalChangeFlush)
// flush children
$if(IncrementalLevelParam)
$if(#isASTNodeDecl)
// flush children
if (attrID.equals("getChild")) {
int i = (Integer)_parameters;
getChild_handler[i].notifyDependencies();
......@@ -214,11 +214,23 @@ handler.notifyDependencies();
$endif
$endif
$CollAttrFlushChecks
$AttrFlushChecks
$endif
]]
ASTDecl.collAttrFlushCheck = [[
$if(IncrementalLevelParam)
if (attrID.equals("$AttrSign") && $(AttrSign)_computed) {
$AttrResetVisit
$AttrResetCache
$CollectionReset
$(AttrSign)_handler.notifyDependencies();
}
$endif
]]
ASTDecl.attrFlushCheck = [[
$if(IncrementalLevelParam)
$if(IsParameterized)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment