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

Updates incremental code generation to comply with refactoring of generated...

Updates incremental code generation to comply with refactoring of generated code for parameterized NTAs.

Parameterized NTAs used to have a List node as parent but this has been changed to a plain ASTNode
referred to as a proxy node. The incremental implementation generated additional code for Lists to
distinguish internal NTA lists from normal lists and made use of iteration over list children.
parent a5907e9b
No related branches found
No related tags found
No related merge requests found
...@@ -38,8 +38,6 @@ aspect IncrementalEval { ...@@ -38,8 +38,6 @@ aspect IncrementalEval {
tt.expand("ASTDecl.relativeNodeIDMethodWithRewrite", out); tt.expand("ASTDecl.relativeNodeIDMethodWithRewrite", out);
tt.expand("List.internalNTAList", out);
tt.bind("NtaIndexCheck", emitNtaIndexCheckString()); tt.bind("NtaIndexCheck", emitNtaIndexCheckString());
tt.expand("ASTDecl.childIsNtaMethod", out); tt.expand("ASTDecl.childIsNtaMethod", out);
......
...@@ -231,7 +231,6 @@ SynDecl.higherOrderAttributeCode:norewrite [[ ...@@ -231,7 +231,6 @@ SynDecl.higherOrderAttributeCode:norewrite [[
$if(#isParameterized) $if(#isParameterized)
if (#(signature)_proxy == null) { if (#(signature)_proxy == null) {
#(signature)_proxy = new $ASTNode(); #(signature)_proxy = new $ASTNode();
$include(AttrDecl.incHookCreateNtaList)
#(signature)_proxy.setParent(this); #(signature)_proxy.setParent(this);
} }
if (#(signature)_value != null) { if (#(signature)_value != null) {
...@@ -246,7 +245,6 @@ SynDecl.higherOrderAttributeCode:rewritesEnabled [[ ...@@ -246,7 +245,6 @@ SynDecl.higherOrderAttributeCode:rewritesEnabled [[
$if(#isParameterized) $if(#isParameterized)
if (#(signature)_proxy == null) { if (#(signature)_proxy == null) {
#(signature)_proxy = new $ASTNode(); #(signature)_proxy = new $ASTNode();
$include(AttrDecl.incHookCreateNtaList)
$if(LegacyRewrite) $if(LegacyRewrite)
#(signature)_proxy.is$$Final = true; #(signature)_proxy.is$$Final = true;
$endif $endif
......
...@@ -38,40 +38,3 @@ $if(IncrementalEnabled) ...@@ -38,40 +38,3 @@ $if(IncrementalEnabled)
} }
$endif $endif
]] ]]
List.internalNTAList = [[
$if(IncrementalEnabled)
$if(#isListDecl)
/** @apilevel internal */
public boolean $List.inc_internalNTAList = false;
/** @apilevel internal */
public java.util.Map $List.inc_internalNTAList_map;
/** @apilevel internal */
public void $List.inc_internalNTAList(java.util.Map m) {
inc_internalNTAList = true;
inc_internalNTAList_map = m;
}
$endif
$endif
]]
AttrDecl.incHookCreateNtaList = [[
$if(IncrementalEnabled)
$if(IncrementalLevelNode)
$if(#getNTA)
#(signature)_proxy.inc_internalNTAList(#(signature)_values);
$endif
$endif
$if(IncrementalLevelRegion)
$if(#getNTA)
#(signature)_proxy.inc_internalNTAList(#(signature)_values);
$endif
$endif
$endif
]]
...@@ -439,52 +439,9 @@ $if(IncrementalLevelRegion) ...@@ -439,52 +439,9 @@ $if(IncrementalLevelRegion)
/** @apilevel internal */ /** @apilevel internal */
public boolean #name.inc_flush_NTA($ASTNode node) { public boolean #name.inc_flush_NTA($ASTNode node) {
$if(#isListDecl) $if(#isListDecl)
if (inc_internalNTAList) {
state().enterConstruction();
int childIndex = getIndexOfChild(node);
removeChild(childIndex);
node.inc_flush_subtree(node.handler());
state().exitConstruction();
if (inc_internalNTAList_map.containsValue(node)) {
for (java.util.Iterator itr = inc_internalNTAList_map.keySet().iterator(); itr.hasNext();) {
Object key = itr.next();
if (inc_internalNTAList_map.get(key) == node) {
inc_internalNTAList_map.remove(key);
break;
}
}
}
return true;
}
if (parent != null) {
int index = parent.getIndexOfChild(this);
if (index >= 0 && parent.childIsNTA(index)) {
state().enterConstruction();
int childIndex = getIndexOfChild(node);
removeChild(childIndex);
node.inc_flush_subtree(node.handler());
state().exitConstruction();
return true;
}
return false;
}
$else
$if(#isListDecl)
if (parent != null) {
int index = parent.getIndexOfChild(this);
if (index >= 0 && parent.childIsNTA(index)) {
state().enterConstruction();
node.setParent(null);
node.inc_flush_subtree(node.handler());
state().exitConstruction();
return true;
}
return false;
}
$else $else
$FlushNTAs $FlushNTAs
$endif $endif
$endif
return false; return false;
} }
$endif $endif
...@@ -619,6 +576,11 @@ $if(IncrementalChangeFlush) ...@@ -619,6 +576,11 @@ $if(IncrementalChangeFlush)
$if(IsNTA) $if(IsNTA)
$if(IsParameterized) $if(IsParameterized)
if ($(AttrSign)_proxy != null) { if ($(AttrSign)_proxy != null) {
for (Object v : $(AttrSign)_values.values()) {
((ASTNode)v).inc_flush_subtree(handler());
}
$(AttrSign)_values.clear();
/*
for (int index = 0; index < $(AttrSign)_proxy.numChildren; index++) { for (int index = 0; index < $(AttrSign)_proxy.numChildren; index++) {
$ASTNode value = $(AttrSign)_proxy.children[index]; $ASTNode value = $(AttrSign)_proxy.children[index];
if (!value.isRegionRoot()) { if (!value.isRegionRoot()) {
...@@ -639,6 +601,7 @@ if ($(AttrSign)_proxy != null) { ...@@ -639,6 +601,7 @@ if ($(AttrSign)_proxy != null) {
} }
} }
} }
*/
} }
$else $else
$if(IsNtaWithTree) $if(IsNtaWithTree)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment