2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_MODIFIER_EXPRESSION_H_
18 #define incl_HPHP_MODIFIER_EXPRESSION_H_
20 #include "hphp/compiler/expression/expression.h"
24 ///////////////////////////////////////////////////////////////////////////////
26 DECLARE_BOOST_TYPES(ModifierExpression
);
28 struct ModifierExpression
: Expression
{
29 explicit ModifierExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS
);
31 DECLARE_BASE_EXPRESSION_VIRTUAL_FUNCTIONS
;
33 void add(int modifier
);
34 void remove(int modifier
);
35 int getCount() const { return m_modifiers
.size();}
36 int operator[](int index
);
38 bool hasDuplicates() const;
41 * Whether the modifiers combine to mean public, including the implicit
42 * public access that occurs when none of public|private|protected are
45 bool isPublic() const;
47 * Use isPublic unless you care about the difference between no-modifiers
48 * implicit public and public-keyword-appears explicitly public.
50 bool isExplicitlyPublic() const;
51 bool isProtected() const;
52 bool isPrivate() const;
53 bool isStatic() const;
54 bool isAbstract() const;
58 int getLocalEffects() const override
{ return NoEffect
; }
60 bool validForFunction() const;
61 bool validForClosure() const;
62 bool validForTraitAliasRule() const;
64 void setHasPrivacy(bool f
) { m_hasPrivacy
= f
; }
67 std::vector
<int> m_modifiers
;
70 bool hasModifier(int modifier
) const;
73 ///////////////////////////////////////////////////////////////////////////////
76 #endif // incl_HPHP_MODIFIER_EXPRESSION_H_