Skip to content

Commit

Permalink
fix: correct an error preventing reading data from a channel with the…
Browse files Browse the repository at this point in the history
… corresponding '<-' operator
  • Loading branch information
jacopodl committed Mar 4, 2024
1 parent 48466d0 commit deb25c5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 3 additions & 0 deletions argon/lang/compiler2/compiler2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1789,6 +1789,9 @@ void Compiler::CompilePrefix(const node::Unary *unary) {
this->Expression((const node::Node *) unary->value);

switch (unary->token_type) {
case scanner::TokenType::ARROW_LEFT:
this->unit_->Emit(vm::OpCode::POPC, &unary->loc);
break;
case scanner::TokenType::EXCLAMATION:
this->unit_->Emit(vm::OpCode::NOT, &unary->loc);
break;
Expand Down
4 changes: 0 additions & 4 deletions argon/lang/parser2/node/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ namespace argon::lang::parser2::node {
AWAIT,
BLOCK,
CALL,
CHAN_IN,
CHAN_OUT,
DEFER,
DICT,
ELVIS,
EXPRESSION,
Expand Down Expand Up @@ -74,7 +71,6 @@ namespace argon::lang::parser2::node {
TRAIT,
TRAP,
TUPLE,
UNARY,
UPDATE,
VARDECL,
YIELD
Expand Down
5 changes: 3 additions & 2 deletions argon/lang/parser2/parser2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1866,7 +1866,7 @@ Node *Parser::ParseChanOut(Context *context) {

auto expr = this->ParseExpression(context, PeekPrecedence(TokenType::ARROW_LEFT));

auto *unary = NewNode<Unary>(type_ast_unary_, false, NodeType::CHAN_OUT);
auto *unary = NewNode<Unary>(type_ast_prefix_, false, NodeType::PREFIX);
if (unary == nullptr) {
Release(expr);

Expand All @@ -1875,6 +1875,7 @@ Node *Parser::ParseChanOut(Context *context) {

unary->loc.start = start;
unary->loc.end = expr->loc.end;
unary->token_type = TokenType::ARROW_LEFT;

unary->value = (ArObject *) expr;

Expand Down Expand Up @@ -2783,7 +2784,7 @@ Node *Parser::ParseWalrus(Context *context, node::Node *left) {
throw ParserException(itm->loc, kStandardError[29], ":=");
}

ListAppend(list, ((const node::Unary*) itm)->value);
ListAppend(list, ((const node::Unary *) itm)->value);
}

multi = true;
Expand Down

0 comments on commit deb25c5

Please sign in to comment.