Skip to content

Commit

Permalink
allow dollar names for fields while parsing, but fail during typing (c…
Browse files Browse the repository at this point in the history
  • Loading branch information
Simn committed Sep 3, 2013
1 parent 0d1cc44 commit 073f4eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ and parse_class_field s =
match s with parser
| [< meta = parse_meta; al = parse_cf_rights true []; s >] ->
let name, pos, k = (match s with parser
| [< '(Kwd Var,p1); name, _ = ident; s >] ->
| [< '(Kwd Var,p1); name, _ = dollar_ident; s >] ->
(match s with parser
| [< '(POpen,_); i1 = property_ident; '(Comma,_); i2 = property_ident; '(PClose,_) >] ->
let t = (match s with parser
Expand Down Expand Up @@ -966,7 +966,7 @@ and parse_cf_rights allow_static l = parser
| [< >] -> l

and parse_fun_name = parser
| [< '(Const (Ident name),_) >] -> name
| [< name,_ = dollar_ident >] -> name
| [< '(Kwd New,_) >] -> "new"

and parse_fun_param = parser
Expand Down
1 change: 1 addition & 0 deletions typeload.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1543,6 +1543,7 @@ let init_class ctx c p context_init herits fields =
let loop_cf f =
let name = f.cff_name in
let p = f.cff_pos in
if name.[0] = '$' && not ctx.com.display then error "Field names starting with a dollar are not allowed" p;
let stat = List.mem AStatic f.cff_access in
let extern = Meta.has Meta.Extern f.cff_meta || c.cl_extern in
let is_abstract,allow_inline =
Expand Down

0 comments on commit 073f4eb

Please sign in to comment.