From 7fb739ebcf0d699fa1540440474e78f1016c013c Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 28 Oct 2020 08:43:18 +0200 Subject: [PATCH] table: make mut/not mut aggregate fields equal (for read only access) --- vlib/v/table/atypes.v | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vlib/v/table/atypes.v b/vlib/v/table/atypes.v index 40352238dc..44d7b5da91 100644 --- a/vlib/v/table/atypes.v +++ b/vlib/v/table/atypes.v @@ -760,9 +760,12 @@ pub mut: } fn (f &Field) equals(o &Field) bool { - // TODO: should all of those be checked ? + // TODO: f.is_mut == o.is_mut was removed here to allow read only access + // to (mut/not mut), but otherwise equal fields; some other new checks are needed: + // - if node is declared mut, and we mutate node.stmts, all stmts fields must be mutable + // - same goes for pub and global, if we call the field from another module return f.name == o.name && - f.typ == o.typ && f.is_pub == o.is_pub && f.is_mut == o.is_mut && f.is_global == o.is_global + f.typ == o.typ && f.is_pub == o.is_pub && f.is_global == o.is_global } pub struct Array {