From be2d809986a80880a0d3c80917fc941423c5f076 Mon Sep 17 00:00:00 2001 From: Sofia Date: Tue, 14 Apr 2026 00:28:12 +0300 Subject: [PATCH] Make ref and deref only parse primary expression --- src/parsing.cpp | 4 ++-- test.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/parsing.cpp b/src/parsing.cpp index e503768..ed8c723 100644 --- a/src/parsing.cpp +++ b/src/parsing.cpp @@ -122,7 +122,7 @@ namespace parsing { } else if (inner.peek().content == "&") { inner.next(); - auto expr = parse_expression(inner).unwrap(); + auto expr = parse_primary_expression(inner).unwrap(); stream.m_position = inner.m_position; return std::unique_ptr { new AST::RefExpression(before_meta + inner.metadata(), std::move(expr)) @@ -130,7 +130,7 @@ namespace parsing { } else if (inner.peek().content == "*") { inner.next(); - auto expr = parse_expression(inner).unwrap(); + auto expr = parse_primary_expression(inner).unwrap(); stream.m_position = inner.m_position; return std::unique_ptr { new AST::DerefExpression(before_meta + inner.metadata(), std::move(expr)) diff --git a/test.c b/test.c index 55eb5e0..8ad90e2 100644 --- a/test.c +++ b/test.c @@ -7,7 +7,7 @@ int fibonacci(int n) { } void modifyvalue(char* otus) { - (*otus) = 20; + *otus = 20; } int main() {