2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-2014 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_BUILTIN_SYMBOLS_H_
18 #define incl_HPHP_BUILTIN_SYMBOLS_H_
20 #include "hphp/compiler/hphp.h"
22 #include "hphp/util/string-bag.h"
23 #include "hphp/runtime/base/class-info.h"
26 ///////////////////////////////////////////////////////////////////////////////
28 DECLARE_EXTENDED_BOOST_TYPES(Type
);
29 DECLARE_BOOST_TYPES(AnalysisResult
);
30 DECLARE_EXTENDED_BOOST_TYPES(FunctionScope
);
31 DECLARE_EXTENDED_BOOST_TYPES(ClassScope
);
32 DECLARE_BOOST_TYPES(VariableTable
);
33 DECLARE_BOOST_TYPES(ConstantTable
);
35 class BuiltinSymbols
{
38 static AnalysisResultPtr s_systemAr
;
40 static bool Load(AnalysisResultPtr ar
);
42 static void LoadFunctions(AnalysisResultPtr ar
,
43 StringToFunctionScopePtrMap
&functions
);
44 static void LoadClasses(AnalysisResultPtr ar
,
45 StringToClassScopePtrMap
&classes
);
46 static void LoadVariables(AnalysisResultPtr ar
,
47 VariableTablePtr variables
);
48 static void LoadConstants(AnalysisResultPtr ar
,
49 ConstantTablePtr constants
);
52 * Testing whether a variable is a PHP superglobal.
54 static bool IsSuperGlobal(const std::string
&name
);
55 static TypePtr
GetSuperGlobalType(const std::string
&name
);
57 static bool IsDeclaredDynamic(const std::string
& name
);
58 static void LoadSuperGlobals();
60 static const char *const GlobalNames
[];
61 static int NumGlobalNames();
63 static StringBag s_strings
;
64 static const char *SystemClasses
[];
66 static StringToTypePtrMap s_superGlobals
;
68 static std::set
<std::string
> s_declaredDynamic
;
70 static FunctionScopePtr
ImportFunctionScopePtr(AnalysisResultPtr ar
,
72 ClassInfo::MethodInfo
*method
);
73 static void ImportExtFunctions(AnalysisResultPtr ar
,
75 static void ImportExtMethods(AnalysisResultPtr ar
,
76 FunctionScopePtrVec
&vec
,
78 static void ImportExtProperties(AnalysisResultPtr ar
,
79 VariableTablePtr dest
,
81 static void ImportExtConstants(AnalysisResultPtr ar
,
82 ConstantTablePtr dest
,
84 static void ImportNativeConstants(AnalysisResultPtr ar
,
85 ConstantTablePtr dest
);
86 static ClassScopePtr
ImportClassScopePtr(AnalysisResultPtr ar
,
88 static void ImportExtClasses(AnalysisResultPtr ar
);
91 ///////////////////////////////////////////////////////////////////////////////
93 #endif // incl_HPHP_BUILTIN_SYMBOLS_H_