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
No related branches found
No related tags found
No related merge requests found
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
tt.expand("ASTDecl.incValueAffectedMethod", out); tt.expand("ASTDecl.incValueAffectedMethod", out);
tt.bind("AttrFlushChecks", emitAttrFlushChecksString()); tt.bind("AttrFlushChecks", emitAttrFlushChecksString());
tt.bind("CollAttrFlushChecks", emitCollAttrFlushChecksString());
tt.expand("ASTDecl.incReactToDepChangeMethod", out); tt.expand("ASTDecl.incReactToDepChangeMethod", out);
tt.bind("FlushAttrs", emitFlushAttrsString()); tt.bind("FlushAttrs", emitFlushAttrsString());
...@@ -206,6 +207,31 @@ ...@@ -206,6 +207,31 @@
return res.toString(); 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. * Creates string with code flushing attributes.
*/ */
......
...@@ -176,9 +176,9 @@ $endif ...@@ -176,9 +176,9 @@ $endif
ASTDecl.incChangeFlush = [[ ASTDecl.incChangeFlush = [[
$if(IncrementalChangeFlush) $if(IncrementalChangeFlush)
// flush children
$if(IncrementalLevelParam) $if(IncrementalLevelParam)
$if(#isASTNodeDecl) $if(#isASTNodeDecl)
// flush children
if (attrID.equals("getChild")) { if (attrID.equals("getChild")) {
int i = (Integer)_parameters; int i = (Integer)_parameters;
getChild_handler[i].notifyDependencies(); getChild_handler[i].notifyDependencies();
...@@ -214,11 +214,23 @@ handler.notifyDependencies(); ...@@ -214,11 +214,23 @@ handler.notifyDependencies();
$endif $endif
$endif $endif
$CollAttrFlushChecks
$AttrFlushChecks $AttrFlushChecks
$endif $endif
]] ]]
ASTDecl.collAttrFlushCheck = [[
$if(IncrementalLevelParam)
if (attrID.equals("$AttrSign") && $(AttrSign)_computed) {
$AttrResetVisit
$AttrResetCache
$CollectionReset
$(AttrSign)_handler.notifyDependencies();
}
$endif
]]
ASTDecl.attrFlushCheck = [[ ASTDecl.attrFlushCheck = [[
$if(IncrementalLevelParam) $if(IncrementalLevelParam)
$if(IsParameterized) $if(IsParameterized)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment