Have front-ends set immutable-related flags on classes and props
commiteb210a1f02fc1f118302fdf1d6c30c3a4360a8b4
authorAlexey Toptygin <alexeyt@fb.com>
Wed, 11 Apr 2018 07:20:18 +0000 (11 00:20 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Wed, 11 Apr 2018 07:22:08 +0000 (11 00:22 -0700)
tree7c42abc77ba37eb71b4977acc26cc9b0f8d2e539
parente20aecdf106eb15bb6e24d3714a79e75b03f6ae0
Have front-ends set immutable-related flags on classes and props

Summary:
Use the __Const attribute on classes and properties to set the is_immutable, has_immutable, and no_dynamic_props attributes on classes, and the is_immutable attribute on properties.
Add unit tests for all the basic write paths.
Support for constructors, verification, and additional unit tests are coming in later diffs.

Reviewed By: oulgen

Differential Revision: D7567596

fbshipit-source-id: 93ca47dcbc2563c61d6696e3dffd3b6e60913140
28 files changed:
hphp/compiler/analysis/emitter.cpp
hphp/hack/src/hhbc/emit_class.ml
hphp/hack/src/hhbc/emit_memoize_method.ml
hphp/hack/src/hhbc/emit_property.ml
hphp/hack/src/hhbc/hhas_attribute.ml
hphp/hack/src/hhbc/hhas_class.ml
hphp/hack/src/hhbc/hhas_parser.mly
hphp/hack/src/hhbc/hhas_property.ml
hphp/hack/src/hhbc/hhbc_hhas.ml
hphp/runtime/vm/as-shared.cpp
hphp/runtime/vm/preclass-emitter.cpp
hphp/runtime/vm/preclass-emitter.h
hphp/runtime/vm/preclass.cpp
hphp/runtime/vm/verifier/fuzzer/fuzzer.ml
hphp/test/slow/object/immutable/basic-individual-prop.php [new file with mode: 0644]
hphp/test/slow/object/immutable/basic-individual-prop.php.expect [new file with mode: 0644]
hphp/test/slow/object/immutable/basic-whole-class.php [new file with mode: 0644]
hphp/test/slow/object/immutable/basic-whole-class.php.expect [new file with mode: 0644]
hphp/test/slow/object/immutable/bind.php [new file with mode: 0644]
hphp/test/slow/object/immutable/bind.php.expect [new file with mode: 0644]
hphp/test/slow/object/immutable/incdec.php [new file with mode: 0644]
hphp/test/slow/object/immutable/incdec.php.expect [new file with mode: 0644]
hphp/test/slow/object/immutable/o_set.php [new file with mode: 0644]
hphp/test/slow/object/immutable/o_set.php.expect [new file with mode: 0644]
hphp/test/slow/object/immutable/setop.php [new file with mode: 0644]
hphp/test/slow/object/immutable/setop.php.expect [new file with mode: 0644]
hphp/test/slow/object/immutable/unset.php [new file with mode: 0644]
hphp/test/slow/object/immutable/unset.php.expect [new file with mode: 0644]