From edb747ceedcfec2eb9f698b0e11b7e94d9174f33 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Tue, 27 Mar 2012 22:08:48 -0700 Subject: Enforce mutability declarations in classes; correct shapes for classes 1. Enforce mutability declarations on class fields. Don't allow any mutation of class fields not declared as mutable (except inside the constructor). 2. Handle classes correctly in shape (treat classes like records). --- src/rustc/syntax/parse/parser.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/rustc/syntax') diff --git a/src/rustc/syntax/parse/parser.rs b/src/rustc/syntax/parse/parser.rs index a898ee840be..3ca2e6a588b 100644 --- a/src/rustc/syntax/parse/parser.rs +++ b/src/rustc/syntax/parse/parser.rs @@ -1684,8 +1684,8 @@ fn parse_let(p: parser) -> @ast::decl { fn parse_instance_var(p:parser) -> (ast::class_member, codemap::span) { let mut is_mutbl = ast::class_immutable; let lo = p.span.lo; - if eat_word(p, "mut") { - is_mutbl = ast::class_mutable; + if eat_word(p, "mut") || eat_word(p, "mutable") { + is_mutbl = ast::class_mutable; } if !is_plain_ident(p) { p.fatal("expecting ident"); -- cgit 1.4.1-3-g733a5