Fix refcounting in arReturn() and stop leaking static strings.
[hiphop-php.git] / hphp / runtime / vm / type-alias.h
blobbaea9965f4775f0ae90dcbbee4132f3322c25b88
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
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 +----------------------------------------------------------------------+
16 #ifndef incl_HPHP_VM_TYPE_ALIAS_H_
17 #define incl_HPHP_VM_TYPE_ALIAS_H_
19 namespace HPHP {
21 //////////////////////////////////////////////////////////////////////
24 * This is the runtime representation of a type alias. Type aliases
25 * are only allowed when HipHop extensions are enabled.
27 * The m_kind field is KindOfObject whenever the type alias is
28 * basically just a name. At runtime we still might resolve this name
29 * to another type alias, becoming a type alias for KindOfArray or
30 * something in that request.
32 * For the per-request struct, see TypeAliasReq below.
34 struct TypeAlias {
35 LowStringPtr name;
36 LowStringPtr value;
37 DataType kind;
38 bool nullable; // Null is allowed; for ?Foo aliases
39 Attr attrs;
41 template<class SerDe> void serde(SerDe& sd) {
42 sd(name)
43 (value)
44 (kind)
45 (nullable)
46 (attrs)
52 * In a given request, a defined type alias is turned into a
53 * TypeAliasReq struct. This contains the information needed to
54 * validate parameter type hints for a type alias at runtime.
56 struct TypeAliasReq {
57 DataType kind; // may be KindOfAny for "HH\\mixed"
58 bool nullable; // for option types, like ?Foo
59 LowClassPtr klass; // nullptr if kind != KindOfObject
60 LowStringPtr name; // needed for error messages; nullptr if not defined
63 //////////////////////////////////////////////////////////////////////
67 #endif