Skip to content
Snippets Groups Projects
Commit ec7182cf authored by René Schöne's avatar René Schöne
Browse files

Add flush option 'api'.

It acts similar to tracing=api, i.e., it will generate the flush* methods but without a method body.
This allows to use the same code base for both incremental and non-incremental variants.
parent 5efce351
Branches trace-incremental
No related tags found
No related merge requests found
...@@ -317,7 +317,8 @@ public class Configuration { ...@@ -317,7 +317,8 @@ public class Configuration {
.addAcceptedValue("full", "flushing of all computed values (combines attr, coll, and rewrite)") .addAcceptedValue("full", "flushing of all computed values (combines attr, coll, and rewrite)")
.addDefaultValue("attr", "adds flushing of attributes (syn,inh)") .addDefaultValue("attr", "adds flushing of attributes (syn,inh)")
.addDefaultValue("coll", "adds flushing of collection attributes") .addDefaultValue("coll", "adds flushing of collection attributes")
.addAcceptedValue("rewrite", "adds flushing of rewrites"); .addAcceptedValue("rewrite", "adds flushing of rewrites")
.addAcceptedValue("api", "flushing is disabled, but generate methods");
ValueOption packageNameOption = new ValueOption("package", ValueOption packageNameOption = new ValueOption("package",
"optional package name for generated classes"); "optional package name for generated classes");
...@@ -1155,10 +1156,10 @@ public class Configuration { ...@@ -1155,10 +1156,10 @@ public class Configuration {
} }
/** /**
* @return {@code true} if --flush=none * @return {@code true} if not --flush=api
*/ */
public boolean flushEnabled() { public boolean flushEnabled() {
return !flushOption.hasValue("none"); return !flushOption.hasValue("api");
} }
/** /**
......
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
ASTNode.flushTreeCacheMethod [[ ASTNode.flushTreeCacheMethod [[
$if(FlushEnabled)
$if(#isASTNodeDecl) $if(#isASTNodeDecl)
/** @apilevel low-level */ /** @apilevel low-level */
public void $ASTNode.flushTreeCache() { public void $ASTNode.flushTreeCache() {
$if(FlushEnabled)
flushCache(); flushCache();
if (children != null) { if (children != null) {
for (int i = 0; i < children.length; i++) { for (int i = 0; i < children.length; i++) {
...@@ -42,61 +42,65 @@ $if(#isASTNodeDecl) ...@@ -42,61 +42,65 @@ $if(#isASTNodeDecl)
} }
} }
} }
}
$endif $endif
}
$endif $endif
]] ]]
ASTDecl.flushCacheMethod [[ ASTDecl.flushCacheMethod [[
$if(FlushEnabled)
$if(#isASTNodeDecl) $if(#isASTNodeDecl)
/** @apilevel low-level */ /** @apilevel low-level */
public void #name.flushCache() { public void #name.flushCache() {
$if(FlushEnabled)
flushAttrAndCollectionCache(); flushAttrAndCollectionCache();
}
$endif $endif
}
$endif $endif
]] ]]
ASTDecl.flushAttrAndCollectionCacheMethod [[ ASTDecl.flushAttrAndCollectionCacheMethod [[
$if(FlushEnabled)
$if(#isASTNodeDecl) $if(#isASTNodeDecl)
/** @apilevel internal */ /** @apilevel internal */
public void #name.flushAttrAndCollectionCache() { public void #name.flushAttrAndCollectionCache() {
$if(FlushEnabled)
$if(FlushAttr) $if(FlushAttr)
flushAttrCache(); flushAttrCache();
$endif $endif
$if(FlushColl) $if(FlushColl)
flushCollectionCache(); flushCollectionCache();
$endif $endif
}
$endif $endif
}
$endif $endif
]] ]]
ASTDecl.flushAttrCacheMethod [[ ASTDecl.flushAttrCacheMethod [[
$if(FlushAttr)
/** @apilevel internal */ /** @apilevel internal */
public void #name.flushAttrCache() { public void #name.flushAttrCache() {
$if(FlushEnabled)
$if(FlushAttr)
$if(!#isASTNodeDecl) $if(!#isASTNodeDecl)
super.flushAttrCache(); super.flushAttrCache();
$endif $endif
$FlushAttrCacheBody $FlushAttrCacheBody
} $endif
$endif $endif
}
]] ]]
ASTDecl.flushCollectionCacheMethod [[ ASTDecl.flushCollectionCacheMethod [[
$if(FlushColl)
/** @apilevel internal */ /** @apilevel internal */
public void #name.flushCollectionCache() { public void #name.flushCollectionCache() {
$if(FlushEnabled)
$if(FlushColl)
$if(!#isASTNodeDecl) $if(!#isASTNodeDecl)
super.flushCollectionCache(); super.flushCollectionCache();
$endif $endif
#flushCollectionCacheCode #flushCollectionCacheCode
} $endif
$endif $endif
}
]] ]]
# TODO: Figure out if this can be removed # TODO: Figure out if this can be removed
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment