Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Minor fixes related to systemlib
Summary:
1) Systemlib deprecation error number
2) OpcodeImpls are always public

Reviewed By: jamesjwu

Differential Revision: D7127262

fbshipit-source-id: 97035258906681f74799ec9252e0d071da85fc9a
  • Loading branch information
oulgen authored and hhvm-bot committed Mar 2, 2018
1 parent 0b150b8 commit e9a1ffe
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
8 changes: 4 additions & 4 deletions hphp/hack/src/hhbc/emit_body.ml
Expand Up @@ -258,16 +258,16 @@ let emit_deprecation_warning scope = function
| _ :: Typed_value.Int i :: _ -> i
| _ -> failwith "deprecated attribute second argument is not an integer"
in
(* TODO: if the function is system function or a native function,
* emit PHP_DEPRECATED error code *)
let user_deprecated_error_code = 16384 (* USER_DEPRECATED *) in
let error_code = if Emit_env.is_systemlib () then
8192 (* E_DEPRECATED *) else 16384 (* E_USER_DEPRECATED *)
in
if Int64.to_int sampling_rate <= 0 then empty else
gather [
trait_instrs;
instr_string deprecation_string;
concat_instruction;
instr_int64 sampling_rate;
instr_int user_deprecated_error_code;
instr_int error_code;
instr_trigger_sampled_error;
instr_popr;
]
Expand Down
24 changes: 14 additions & 10 deletions hphp/hack/src/hhbc/emit_method.ml
Expand Up @@ -63,27 +63,31 @@ let from_ast_wrapper : bool -> _ ->
if not (has_valid_access_modifiers ast_method.Ast.m_kind) then
Emit_fatal.raise_fatal_parse Pos.none
"Multiple access type modifiers are not allowed";
let namespace = ast_class.Ast.c_namespace in
let method_attributes =
Emit_attribute.from_asts namespace ast_method.Ast.m_user_attributes in
let is_native = Hhas_attribute.is_native method_attributes in
let is_native_opcode_impl =
Hhas_attribute.is_native_opcode_impl method_attributes in
let method_is_abstract =
ast_class.Ast.c_kind = Ast.Cinterface ||
has_kind ast_method Ast.Abstract in
let method_is_final = has_kind ast_method Ast.Final in
let method_is_static = has_kind ast_method Ast.Static in
let namespace = ast_class.Ast.c_namespace in
let method_attributes =
Emit_attribute.from_asts namespace ast_method.Ast.m_user_attributes in
let method_is_private =
privatize || has_kind ast_method Ast.Private in
not is_native_opcode_impl &&
(privatize || has_kind ast_method Ast.Private) in
let method_is_protected =
not privatize && has_kind ast_method Ast.Protected in
not is_native_opcode_impl &&
not privatize &&
has_kind ast_method Ast.Protected in
let method_is_public =
not privatize && (
is_native_opcode_impl ||
(not privatize && (
has_kind ast_method Ast.Public ||
(not method_is_private && not method_is_protected)) in
(not method_is_private && not method_is_protected))) in
let is_memoize =
Emit_attribute.ast_any_is_memoize ast_method.Ast.m_user_attributes in
let is_native = Hhas_attribute.is_native method_attributes in
let is_native_opcode_impl =
Hhas_attribute.is_native_opcode_impl method_attributes in
let deprecation_info = Hhas_attribute.deprecation_info method_attributes in
let is_dynamically_callable =
((Hhas_attribute.is_dynamically_callable method_attributes) ||
Expand Down

0 comments on commit e9a1ffe

Please sign in to comment.