We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fddd63a commit 49228f3Copy full SHA for 49228f3
cobalt-ast/src/ast/ops.rs
@@ -280,10 +280,25 @@ impl<'src> AST<'src> for PrefixAST<'src> {
280
return (Value::error(), errs);
281
}
282
(
283
- v.pre_op((self.op, self.loc), ctx).unwrap_or_else(|e| {
284
- errs.push(e);
285
- Value::error()
286
- }),
+ if self.op == "&" {
+ if let Some(ty) = v.data_type.downcast::<types::Reference>() {
+ Value {
+ data_type: types::Pointer::new(ty.base()),
287
+ ..v
288
+ }
289
+ } else {
290
+ Value::new(
291
+ v.addr(ctx).map(From::from),
292
+ None,
293
+ v.data_type.add_ref(v.frozen.is_none()),
294
+ )
295
296
297
+ v.pre_op((self.op, self.loc), ctx).unwrap_or_else(|e| {
298
+ errs.push(e);
299
+ Value::error()
300
+ })
301
+ },
302
errs,
303
)
304
0 commit comments