aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve/rust-ast-resolve-expr.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-01-25 17:03:36 +0000
committerPhilip Herron <herron.philip@googlemail.com>2021-01-27 10:42:25 +0000
commit8578c61be5061fab91fe679a15fd68ab5fad987c (patch)
treef09524d5f8bf17fab00618ef7e8e98fd905a557e /gcc/rust/resolve/rust-ast-resolve-expr.h
parent854aad3b58e747cad3e46b522c9ef765bdfadca4 (diff)
downloadgcc-8578c61be5061fab91fe679a15fd68ab5fad987c.zip
gcc-8578c61be5061fab91fe679a15fd68ab5fad987c.tar.gz
gcc-8578c61be5061fab91fe679a15fd68ab5fad987c.tar.bz2
Add mutablity checks and left hand size assignee checker
In order to assign to a name we must ensure the LHS is a valid expression to assign to. This leads onto actually checking if this is a mutable declaration or not. Once these checks pass the name resolver we can in GIMPLE create immutable types for these declarations to help with optimization. Fixes #77
Diffstat (limited to 'gcc/rust/resolve/rust-ast-resolve-expr.h')
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-expr.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-expr.h b/gcc/rust/resolve/rust-ast-resolve-expr.h
index 229b26a..9366818 100644
--- a/gcc/rust/resolve/rust-ast-resolve-expr.h
+++ b/gcc/rust/resolve/rust-ast-resolve-expr.h
@@ -22,6 +22,7 @@
#include "rust-ast-resolve-base.h"
#include "rust-ast-full.h"
#include "rust-ast-resolve-struct-expr-field.h"
+#include "rust-ast-verify-assignee.h"
namespace Rust {
namespace Resolver {
@@ -94,6 +95,9 @@ public:
{
ResolveExpr::go (expr.get_left_expr ().get (), expr.get_node_id ());
ResolveExpr::go (expr.get_right_expr ().get (), expr.get_node_id ());
+
+ // need to verify the assignee
+ VerifyAsignee::go (expr.get_left_expr ().get (), expr.get_node_id ());
}
void visit (AST::IdentifierExpr &expr)
@@ -120,6 +124,9 @@ public:
{
ResolveExpr::go (expr.get_left_expr ().get (), expr.get_node_id ());
ResolveExpr::go (expr.get_right_expr ().get (), expr.get_node_id ());
+
+ // need to verify the assignee
+ VerifyAsignee::go (expr.get_left_expr ().get (), expr.get_node_id ());
}
void visit (AST::ComparisonExpr &expr)