ASM style checker improvements

This commit is contained in:
Hackerpilot 2014-08-19 20:50:57 +00:00
parent 0401476675
commit b292799a07
2 changed files with 4 additions and 1 deletions

View File

@ -26,7 +26,8 @@ class AsmStyleCheck : BaseAnalyzer
override void visit(const AsmBrExp brExp)
{
if (brExp.asmBrExp !is null)
if (brExp.asmBrExp !is null && brExp.asmBrExp.asmUnaExp !is null
&& brExp.asmBrExp.asmUnaExp.asmPrimaryExp !is null)
{
addErrorMessage(brExp.line, brExp.column,
"This is confusing because it looks like an array index. Rewrite a[1] as [a + 1] to clarify.");
@ -46,6 +47,7 @@ unittest
asm
{
mov a, someArray[1]; // [warn]: This is confusing because it looks like an array index. Rewrite a[1] as [a + 1] to clarify.
add near ptr [EAX], 3;
}
}
}c, sac);

View File

@ -1045,6 +1045,7 @@ class XMLPrinter : ASTVisitor
override void visit(const PragmaDeclaration pragmaDeclaration) { mixin (tagAndAccept!"pragmaDeclaration"); }
override void visit(const PragmaExpression pragmaExpression) { mixin (tagAndAccept!"pragmaExpression"); }
override void visit(const PrimaryExpression primaryExpression) { mixin (tagAndAccept!"primaryExpression"); }
override void visit(const Register register) { mixin (tagAndAccept!"register"); }
override void visit(const ScopeGuardStatement scopeGuardStatement) { mixin (tagAndAccept!"scopeGuardStatement"); }
override void visit(const SharedStaticConstructor sharedStaticConstructor) { mixin (tagAndAccept!"sharedStaticConstructor"); }
override void visit(const SharedStaticDestructor sharedStaticDestructor) { mixin (tagAndAccept!"sharedStaticDestructor"); }