From 4b2124e82d7711e77b0a72bb28905844de8766b2 Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Tue, 9 May 2023 05:02:01 +0200 Subject: [PATCH] upgrade libdparse to 0.23.0 --- DCD | 2 +- dub.json | 4 +- dub.selections.json | 4 +- libdparse | 2 +- src/dscanner/analysis/assert_without_msg.d | 4 +- src/dscanner/analysis/mismatched_args.d | 4 +- .../properly_documented_public_functions.d | 4 +- src/dscanner/analysis/range.d | 4 +- src/dscanner/astprinter.d | 87 +++++++++++-------- 9 files changed, 63 insertions(+), 52 deletions(-) diff --git a/DCD b/DCD index 4946d49..1c60c54 160000 --- a/DCD +++ b/DCD @@ -1 +1 @@ -Subproject commit 4946d49abdc35810254151923bab30fb3cc2c004 +Subproject commit 1c60c5480f70db568279e4637a5033953c777406 diff --git a/dub.json b/dub.json index a00d052..8f02074 100644 --- a/dub.json +++ b/dub.json @@ -11,8 +11,8 @@ "built_with_dub" ], "dependencies": { - "libdparse": ">=0.21.1 <0.23.0", - "dcd:dsymbol": ">=0.14.0 <0.16.0", + "libdparse": ">=0.23.0 <0.24.0", + "dcd:dsymbol": ">=0.16.0-beta.2 <0.17.0", "inifiled": "~>1.3.1", "emsi_containers": "~>0.9.0", "libddoc": "~>0.8.0" diff --git a/dub.selections.json b/dub.selections.json index dcada97..2c085ca 100644 --- a/dub.selections.json +++ b/dub.selections.json @@ -1,12 +1,12 @@ { "fileVersion": 1, "versions": { - "dcd": "0.15.2", + "dcd": "0.16.0-beta.2", "dsymbol": "0.13.0", "emsi_containers": "0.9.0", "inifiled": "1.3.3", "libddoc": "0.8.0", - "libdparse": "0.22.0", + "libdparse": "0.23.0", "stdx-allocator": "2.77.5" } } diff --git a/libdparse b/libdparse index 98bf0f4..86c9bf4 160000 --- a/libdparse +++ b/libdparse @@ -1 +1 @@ -Subproject commit 98bf0f4166578717e0b78472ff5054d6f918e797 +Subproject commit 86c9bf44c96e1666eb175c749cc26f62c2008979 diff --git a/src/dscanner/analysis/assert_without_msg.d b/src/dscanner/analysis/assert_without_msg.d index e5a15c6..a6aa4d7 100644 --- a/src/dscanner/analysis/assert_without_msg.d +++ b/src/dscanner/analysis/assert_without_msg.d @@ -53,8 +53,8 @@ final class AssertWithoutMessageCheck : BaseAnalyzer .unaryExpression.primaryExpression.identifierOrTemplateInstance) { auto ident = iot.identifier; - if (ident.text == "enforce" && expr.arguments !is null && expr.arguments.argumentList !is null && - expr.arguments.argumentList.items.length < 2) + if (ident.text == "enforce" && expr.arguments !is null && expr.arguments.namedArgumentList !is null && + expr.arguments.namedArgumentList.items.length < 2) addErrorMessage(ident.line, ident.column, KEY, MESSAGE); } } diff --git a/src/dscanner/analysis/mismatched_args.d b/src/dscanner/analysis/mismatched_args.d index 0507113..8c9ee92 100644 --- a/src/dscanner/analysis/mismatched_args.d +++ b/src/dscanner/analysis/mismatched_args.d @@ -109,11 +109,11 @@ final class IdentVisitor : ASTVisitor final class ArgVisitor : ASTVisitor { - override void visit(const ArgumentList al) + override void visit(const NamedArgumentList al) { foreach (a; al.items) { - auto u = cast(UnaryExpression) a; + auto u = cast(UnaryExpression) a.assignExpression; if (u !is null) visit(u); else diff --git a/src/dscanner/analysis/properly_documented_public_functions.d b/src/dscanner/analysis/properly_documented_public_functions.d index 3f7b3c9..6847f76 100644 --- a/src/dscanner/analysis/properly_documented_public_functions.d +++ b/src/dscanner/analysis/properly_documented_public_functions.d @@ -91,8 +91,8 @@ final class ProperlyDocumentedPublicFunctions : BaseAnalyzer thrown ~= newNamedType(tsa.token); } // enforce!(Type)(condition); - else if (const TemplateArgumentList tal = safeAccess(iot.templateInstance) - .templateArguments.templateArgumentList) + else if (const NamedTemplateArgumentList tal = safeAccess(iot.templateInstance) + .templateArguments.namedTemplateArgumentList) { if (tal.items.length && tal.items[0].type) thrown ~= tal.items[0].type; diff --git a/src/dscanner/analysis/range.d b/src/dscanner/analysis/range.d index f7a6f65..1b78840 100644 --- a/src/dscanner/analysis/range.d +++ b/src/dscanner/analysis/range.d @@ -106,9 +106,9 @@ final class BackwardsRangeCheck : BaseAnalyzer if (index.low !is null && index.high !is null) { state = State.left; - visit(index.low); + dynamicDispatch(index.low); state = State.right; - visit(index.high); + dynamicDispatch(index.high); state = State.ignore; if (hasLeft && hasRight && left > right) { diff --git a/src/dscanner/astprinter.d b/src/dscanner/astprinter.d index fa3f265..e0ca1da 100644 --- a/src/dscanner/astprinter.d +++ b/src/dscanner/astprinter.d @@ -21,12 +21,12 @@ class XMLPrinter : ASTVisitor { output.writeln(""); output.writeln(""); - visit(addExpression.left); + dynamicDispatch(addExpression.left); output.writeln(""); if (addExpression.right !is null) { output.writeln(""); - visit(addExpression.right); + dynamicDispatch(addExpression.right); output.writeln(""); } output.writeln(""); @@ -56,12 +56,12 @@ class XMLPrinter : ASTVisitor { output.writeln(""); output.writeln(""); - visit(andAndExpression.left); + dynamicDispatch(andAndExpression.left); output.writeln(""); if (andAndExpression.right !is null) { output.writeln(""); - visit(andAndExpression.right); + dynamicDispatch(andAndExpression.right); output.writeln(""); } output.writeln(""); @@ -71,12 +71,12 @@ class XMLPrinter : ASTVisitor { output.writeln(""); output.writeln(""); - visit(andExpression.left); + dynamicDispatch(andExpression.left); output.writeln(""); if (andExpression.right !is null) { output.writeln(""); - visit(andExpression.right); + dynamicDispatch(andExpression.right); output.writeln(""); } output.writeln(""); @@ -182,13 +182,13 @@ class XMLPrinter : ASTVisitor if (caseRangeStatement.low !is null) { output.writeln(""); - visit(caseRangeStatement.low); + dynamicDispatch(caseRangeStatement.low); output.writeln(""); } if (caseRangeStatement.high !is null) { output.writeln(""); - visit(caseRangeStatement.high); + dynamicDispatch(caseRangeStatement.high); output.writeln(""); } if (caseRangeStatement.declarationsAndStatements !is null) @@ -286,7 +286,7 @@ class XMLPrinter : ASTVisitor if (deprecated_.assignExpression !is null) { output.writeln(""); - visit(deprecated_.assignExpression); + dynamicDispatch(deprecated_.assignExpression); output.writeln(""); } else @@ -311,7 +311,7 @@ class XMLPrinter : ASTVisitor visit(enumMember.type); output.write("", enumMember.name.text, ""); if (enumMember.assignExpression !is null) - visit(enumMember.assignExpression); + dynamicDispatch(enumMember.assignExpression); output.writeln(""); } @@ -327,10 +327,10 @@ class XMLPrinter : ASTVisitor { output.writeln(""); output.writeln(""); - visit(equalExpression.left); + dynamicDispatch(equalExpression.left); output.writeln(""); output.writeln(""); - visit(equalExpression.right); + dynamicDispatch(equalExpression.right); output.writeln(""); output.writeln(""); } @@ -447,10 +447,10 @@ class XMLPrinter : ASTVisitor else output.writeln(""); output.writeln(""); - visit(identityExpression.left); + dynamicDispatch(identityExpression.left); output.writeln(""); output.writeln(""); - visit(identityExpression.right); + dynamicDispatch(identityExpression.right); output.writeln(""); output.writeln(""); } @@ -500,10 +500,10 @@ class XMLPrinter : ASTVisitor else output.writeln(""); output.writeln(""); - visit(inExpression.left); + dynamicDispatch(inExpression.left); output.writeln(""); output.writeln(""); - visit(inExpression.right); + dynamicDispatch(inExpression.right); output.writeln(""); output.writeln(""); } @@ -572,10 +572,10 @@ class XMLPrinter : ASTVisitor { output.writeln(""); output.writeln(""); - visit(keyValuePair.key); + dynamicDispatch(keyValuePair.key); output.writeln(""); output.writeln(""); - visit(keyValuePair.value); + dynamicDispatch(keyValuePair.value); output.writeln(""); output.writeln(""); } @@ -635,12 +635,12 @@ class XMLPrinter : ASTVisitor { output.writeln(""); output.writeln(""); - visit(mulExpression.left); + dynamicDispatch(mulExpression.left); output.writeln(""); if (mulExpression.right !is null) { output.writeln(""); - visit(mulExpression.right); + dynamicDispatch(mulExpression.right); output.writeln(""); } output.writeln(""); @@ -650,12 +650,12 @@ class XMLPrinter : ASTVisitor { output.writeln(""); output.writeln(""); - visit(orOrExpression.left); + dynamicDispatch(orOrExpression.left); output.writeln(""); if (orOrExpression.right !is null) { output.writeln(""); - visit(orOrExpression.right); + dynamicDispatch(orOrExpression.right); output.writeln(""); } output.writeln(""); @@ -686,12 +686,12 @@ class XMLPrinter : ASTVisitor { output.writeln(""); output.writeln(""); - visit(powExpression.left); + dynamicDispatch(powExpression.left); output.writeln(""); if (powExpression.right !is null) { output.writeln(""); - visit(powExpression.right); + dynamicDispatch(powExpression.right); output.writeln(""); } output.writeln(""); @@ -702,10 +702,10 @@ class XMLPrinter : ASTVisitor output.writeln(""); output.writeln(""); - visit(relExpression.left); + dynamicDispatch(relExpression.left); output.writeln(""); output.writeln(""); - visit(relExpression.right); + dynamicDispatch(relExpression.right); output.writeln(""); output.writeln(""); } @@ -727,10 +727,10 @@ class XMLPrinter : ASTVisitor output.writeln(""); output.writeln(""); - visit(shiftExpression.left); + dynamicDispatch(shiftExpression.left); output.writeln(""); output.writeln(""); - visit(shiftExpression.right); + dynamicDispatch(shiftExpression.right); output.writeln(""); output.writeln(""); } @@ -763,7 +763,7 @@ class XMLPrinter : ASTVisitor if (templateAliasParameter.colonExpression !is null) { output.writeln(""); - visit(templateAliasParameter.colonExpression); + dynamicDispatch(templateAliasParameter.colonExpression); output.writeln(""); } else if (templateAliasParameter.colonType !is null) @@ -776,7 +776,7 @@ class XMLPrinter : ASTVisitor if (templateAliasParameter.assignExpression !is null) { output.writeln(""); - visit(templateAliasParameter.assignExpression); + dynamicDispatch(templateAliasParameter.assignExpression); output.writeln(""); } else if (templateAliasParameter.assignType !is null) @@ -921,14 +921,14 @@ class XMLPrinter : ASTVisitor if (typeSuffix.high !is null) { output.writeln(""); - visit(typeSuffix.low); + dynamicDispatch(typeSuffix.low); output.writeln(""); output.writeln(""); - visit(typeSuffix.high); + dynamicDispatch(typeSuffix.high); output.writeln(""); } else - visit(typeSuffix.low); + dynamicDispatch(typeSuffix.low); output.writeln(""); } } @@ -1000,12 +1000,12 @@ class XMLPrinter : ASTVisitor { output.writeln(""); output.writeln(""); - visit(xorExpression.left); + dynamicDispatch(xorExpression.left); output.writeln(""); if (xorExpression.right !is null) { output.writeln(""); - visit(xorExpression.right); + dynamicDispatch(xorExpression.right); output.writeln(""); } output.writeln(""); @@ -1017,23 +1017,34 @@ class XMLPrinter : ASTVisitor if (index.high) { output.writeln(""); - visit(index.low); + dynamicDispatch(index.low); output.writeln(""); output.writeln(""); - visit(index.high); + dynamicDispatch(index.high); output.writeln(""); } else - visit(index.low); + dynamicDispatch(index.low); output.writeln(""); } + override void visit(const NamedArgument arg) + { + if (arg.name.text.length) + output.writeln(""); + else + output.writeln(""); + dynamicDispatch(arg.assignExpression); + output.writeln(""); + } + // dfmt off override void visit(const AliasInitializer aliasInitializer) { mixin (tagAndAccept!"aliasInitializer"); } override void visit(const AliasThisDeclaration aliasThisDeclaration) { mixin (tagAndAccept!"aliasThisDeclaration"); } override void visit(const AnonymousEnumDeclaration anonymousEnumDeclaration) { mixin (tagAndAccept!"anonymousEnumDeclaration"); } override void visit(const ArgumentList argumentList) { mixin (tagAndAccept!"argumentList"); } + override void visit(const NamedArgumentList argumentList) { mixin (tagAndAccept!"argumentList"); } override void visit(const Arguments arguments) { mixin (tagAndAccept!"arguments"); } override void visit(const ArrayInitializer arrayInitializer) { mixin (tagAndAccept!"arrayInitializer"); } override void visit(const ArrayLiteral arrayLiteral) { mixin (tagAndAccept!"arrayLiteral"); }