Branch: Tag:

2018-11-07

2018-11-07 10:03:56 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Added syntax for marking a class as constant.

The class annotation syntax

@constant;

now causes the class to have the PROGRAM_CONSTANT flag set.

This flag indicates that objects created from it may be regarded
as constant/immutable and shareable (ie they do not contain any
relevant state other than that passed to them at creation time).
The compiler and/or runtime may replace such objects with other
objects that they compare `== with at any time.

1081:    compiler_add_annotations(-1, $1);    free_node($1);    } +  | '@' TOK_CONSTANT ';' +  { +  Pike_compiler->new_program->flags |= PROGRAM_CONSTANT; +  }    | typedef {}    | static_assertion expected_semicolon {}    | error TOK_LEX_EOF