From 40ccaf9cd7430343f46a76a147dd1d70467610bf Mon Sep 17 00:00:00 2001 From: MoonlightSentinel Date: Sun, 3 May 2020 22:36:02 +0200 Subject: [PATCH] Accept this as an asm operand --- src/dparse/parser.d | 5 ++++- test/pass_files/asm.d | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/dparse/parser.d b/src/dparse/parser.d index 01731ff3..855a8e94 100644 --- a/src/dparse/parser.d +++ b/src/dparse/parser.d @@ -735,6 +735,8 @@ class Parser * | $(RULE register : AsmExp) * | $(RULE identifierChain) * | $(LITERAL '$') + * | $(LITERAL 'this') + * | $(LITERAL '__LOCAL_SIZE') * ;) */ AsmPrimaryExp parseAsmPrimaryExp() @@ -748,6 +750,7 @@ class Parser foreach (NL; NumberLiterals) {case NL:} case tok!"stringLiteral": case tok!"$": + case tok!"this": node.token = advance(); break; case tok!"identifier": @@ -765,7 +768,7 @@ class Parser mixin(parseNodeQ!(`node.identifierChain`, `IdentifierChain`)); break; default: - error("Float literal, integer literal, `$`, or identifier expected."); + error("Float literal, integer literal, `$`, `this` or identifier expected."); return null; } node.tokens = tokens[startIndex .. index]; diff --git a/test/pass_files/asm.d b/test/pass_files/asm.d index b81b8386..66ac1f6e 100644 --- a/test/pass_files/asm.d +++ b/test/pass_files/asm.d @@ -46,5 +46,8 @@ void doStuff() align 4 ; LABEL: ; ; + + mov EAX, this; + mov ECX, __LOCAL_SIZE; } }