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

Removes legacy rewrite code from code generated for incremental/region.

parent 9a8f3bb4
No related branches found
No related tags found
No related merge requests found
...@@ -373,18 +373,6 @@ $if(IncrementalLevelNode) ...@@ -373,18 +373,6 @@ $if(IncrementalLevelNode)
} }
$endif $endif
$if(IncrementalLevelRegion)
/** @apilevel internal */
public boolean $ASTNode.inc_flush_child($ASTNode node) {
for (int i = 0; node.mayHaveRewrite() && i < children.length; i++) {
if (children[i] == node) {
return inc_restoreInitialForIndex(i, node.handler());
}
}
return true;
}
$endif
$endif $endif
$endif $endif
$endif $endif
...@@ -525,80 +513,14 @@ $if(IncrementalLevelRegion) ...@@ -525,80 +513,14 @@ $if(IncrementalLevelRegion)
$if(#isRegionRoot) $if(#isRegionRoot)
/** @apilevel internal */ /** @apilevel internal */
public boolean #name.inc_flushRegionRoot() { public boolean #name.inc_flushRegionRoot() {
// Check for rewrites
// check for inner rewrite in region root
boolean rewriteFlushed = true;
if (parent != null) {
rewriteFlushed = parent.inc_flush_child(this);
// region root had an outer rewrite which was flushed (parent == null) -> done
if (rewriteFlushed && parent == null) {
return true;
}
}
boolean innerRewrite = false;
if (rewriteFlushed) {
// the region may have inner rewrites
innerRewrite = inc_checkRegionForInnerRewrite();
} else {
// region root had an inner rewrite which wasn't flushed
innerRewrite = true;
}
// Inner rewrites in the region (including the root) means abort and notify the enclosing rewritten node
if (innerRewrite) {
$ASTNode enclosingNode = inc_locateEnclosingRewrittenNode();
enclosingNode.handler().flushRegion();
return false;
}
// Check NTAs, this may remove the region
boolean regionRemoved = false;
if (parent != null) {
regionRemoved = parent.inc_flush_NTA(this); // check NTA
}
// region is still here, flush remaining values and outer rewrites
if (!regionRemoved) {
inc_flushRegion_rewrites();
inc_flushRegion(); inc_flushRegion();
}
return true; return true;
} }
$else $else
$if(#isASTNodeDecl) $if(#isASTNodeDecl)
/** @apilevel internal */ /** @apilevel internal */
public boolean #name.inc_flushRegionRoot() { public boolean #name.inc_flushRegionRoot() {
// Check for rewrites
// check for inner rewrite in region root
boolean rewriteFlushed = true;
if (parent != null) {
rewriteFlushed = parent.inc_flush_child(this);
// region root had an outer rewrite which was flushed (parent == null) -> done
if (rewriteFlushed && parent == null) {
return true;
}
}
boolean innerRewrite = false;
if (rewriteFlushed) {
// the region may have inner rewrites
innerRewrite = inc_checkRegionForInnerRewrite();
} else {
// region root had an inner rewrite which wasn't flushed
innerRewrite = true;
}
// Inner rewrites in the region (including the root) means abort and notify the enclosing rewritten node
if (innerRewrite) {
$ASTNode enclosingNode = inc_locateEnclosingRewrittenNode();
enclosingNode.handler().flushRegion();
return false;
}
// Check NTAs, this may remove the region
boolean regionRemoved = false;
if (parent != null) {
regionRemoved = parent.inc_flush_NTA(this); // check NTA
}
// region is still here, flush remaining values and outer rewrites
if (!regionRemoved) {
inc_flushRegion_rewrites();
inc_flushRegion(); inc_flushRegion();
}
return true; return true;
} }
$endif $endif
...@@ -639,29 +561,6 @@ ASTNode.incCheckRegionForInnerRewriteMethod = [[ ...@@ -639,29 +561,6 @@ ASTNode.incCheckRegionForInnerRewriteMethod = [[
$if(IncrementalEnabled) $if(IncrementalEnabled)
$if(IncrementalChangeFlush) $if(IncrementalChangeFlush)
$if(IncrementalLevelRegion)
$if(#isASTNodeDecl)
/** @apilevel internal */
public boolean $ASTNode.inc_checkRegionForInnerRewrite() {
for (int i = 0; children != null && children_computed != null && i < children.length && i < children_computed.length; i++) {
$ASTNode child = children[i];
if (child != null && !child.isRegionRoot()) {
if (children_computed[i]) {
if (init_children != null && i < init_children.length && init_children[i] == null) {
return true;
}
} else {
if (child.inc_checkRegionForInnerRewrite()) {
return true;
}
}
}
}
return false;
}
$endif
$endif
$if(IncrementalLevelNode) $if(IncrementalLevelNode)
$if(#isASTNodeDecl) $if(#isASTNodeDecl)
/** @apilevel internal */ /** @apilevel internal */
...@@ -782,32 +681,6 @@ ASTNode.incFlushRegionRewritesMethod = [[ ...@@ -782,32 +681,6 @@ ASTNode.incFlushRegionRewritesMethod = [[
$if(IncrementalEnabled) $if(IncrementalEnabled)
$if(IncrementalChangeFlush) $if(IncrementalChangeFlush)
$if(IncrementalLevelRegion)
$if(#isASTNodeDecl)
/** @apilevel internal */
public boolean $ASTNode.inc_flushRegion_rewrites() {
for (int i = 0; children != null && i < children.length; i++) {
$ASTNode child = children[i];
if (child == null || child.isRegionRoot()) {
continue;
}
// rewritten child
if (children_computed != null && i < children_computed.length && children_computed[i]) {
if (!inc_restoreInitialForIndex(i, handler())) {
return false;
}
} else {
// not rewritten child
if (!child.inc_flushRegion_rewrites()) {
return false;
}
}
}
return true;
}
$endif
$endif
$if(IncrementalLevelAttr) $if(IncrementalLevelAttr)
$if(#isASTNodeDecl) $if(#isASTNodeDecl)
/** @apilevel internal */ /** @apilevel internal */
......
...@@ -382,11 +382,11 @@ ASTNode.incHookGetChildExitEval = [[ ...@@ -382,11 +382,11 @@ ASTNode.incHookGetChildExitEval = [[
$if(IncrementalEnabled) $if(IncrementalEnabled)
$if(IncrementalLevelParam) $if(IncrementalLevelParam)
//state().exitAttrStoreEval(getChild_handler[i]); state().exitAttrStoreEval(getChild_handler[i]);
$endif $endif
$if(IncrementalLevelRegion) $if(IncrementalLevelRegion)
//state().exitAttrStoreEval(handler()); state().exitAttrStoreEval(handler());
$endif $endif
$endif $endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment