aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-expr.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2020-12-24 21:26:26 +0000
committerPhilip Herron <herron.philip@googlemail.com>2020-12-25 18:23:22 +0000
commit467141184aa274126ff7e2a41d08bb621b7a3fdf (patch)
treef15fd81fb434787967d3837651891bfaa73fee80 /gcc/rust/backend/rust-compile-expr.h
parent8d34ac3c1602d8506ae4b65d92075be86f5a6c9a (diff)
downloadgcc-467141184aa274126ff7e2a41d08bb621b7a3fdf.zip
gcc-467141184aa274126ff7e2a41d08bb621b7a3fdf.tar.gz
gcc-467141184aa274126ff7e2a41d08bb621b7a3fdf.tar.bz2
Implement constant expressions
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.h')
-rw-r--r--gcc/rust/backend/rust-compile-expr.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h
index 5c3206a..871b4ba 100644
--- a/gcc/rust/backend/rust-compile-expr.h
+++ b/gcc/rust/backend/rust-compile-expr.h
@@ -105,6 +105,11 @@ public:
return;
}
+ // this could be a constant reference
+ if (ctx->lookup_const_decl (ref, &translated))
+ return;
+
+ // must be an identifier
Bvariable *var = nullptr;
if (!ctx->lookup_var_decl (ref, &var))
{