treat default and synchronized as modifiers

This commit is contained in:
Dave Holoway
2020-06-08 13:04:57 +01:00
parent 6fd6376dea
commit 3a85c6f819
2 changed files with 14 additions and 3 deletions

View File

@@ -18,6 +18,11 @@ const { getOperatorType, Token } = require('./tokenizer');
function flattenBlocks(blocks) {
return blocks.reduce((arr,block) => {
if (block instanceof Token) {
// 'default' and 'synchronised' are not modifiers inside method bodies
if (block.kind === 'modifier' && /^(default|synchronized)$/.test(block.value)) {
block.kind = 'statement-kw'
block.simplified = block.value;
}
arr.push(block);
} else {
arr = [...arr, ...flattenBlocks(block.blockArray().blocks)];