Return member_lval from Array::lval{,Ref}()
[hiphop-php.git] / hphp / runtime / base / member-val-inl.h
blob0417a4466b2ac2db54aa52b2aab56ee97399e5e7
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
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 #include "hphp/runtime/base/header-kind.h"
18 #include "hphp/runtime/base/typed-value.h"
20 namespace HPHP {
22 ///////////////////////////////////////////////////////////////////////////////
24 inline member_lval::member_lval()
25 : m_base(nullptr)
26 , m_ptr(nullptr)
29 inline member_lval::member_lval(HeapObject* base, member_lval::ptr_u ptr)
30 : m_base(base)
31 , m_ptr(ptr)
34 inline member_lval::member_lval(HeapObject* base, TypedValue* elem)
35 : m_base(base)
36 , m_ptr(elem)
39 inline HeapObject* member_lval::base() const {
40 return m_base;
43 inline ArrayData* member_lval::arr_base() const {
44 assertx(isArrayKind(m_base->kind()));
45 return m_arr;
48 inline member_lval::operator bool() const {
49 return !!m_ptr;
52 inline bool member_lval::has_ref() const {
53 return !!m_ptr;
56 inline Value& member_lval::val() const {
57 return *m_ptr.val;
60 inline DataType& member_lval::type() const {
61 return m_ptr.tv->m_type;
64 inline TypedValue* member_lval::tv_ptr() const {
65 return m_ptr.tv;
68 inline member_lval::ptr_u member_lval::elem() const {
69 return m_ptr;
72 ///////////////////////////////////////////////////////////////////////////////
74 inline member_rval::member_rval()
75 : m_base(nullptr)
76 , m_ptr(nullptr)
79 inline member_rval::member_rval(const HeapObject* base,
80 member_rval::ptr_u ptr)
81 : m_base(base)
82 , m_ptr(ptr)
85 inline member_rval::member_rval(const HeapObject* base,
86 const TypedValue* elem)
87 : m_base(base)
88 , m_ptr(elem)
91 inline const HeapObject* member_rval::base() const {
92 return m_base;
95 inline member_rval::operator bool() const {
96 return !!m_ptr;
99 inline bool member_rval::has_val() const {
100 return !!m_ptr;
103 inline Value member_rval::val() const {
104 return *m_ptr.val;
107 inline DataType member_rval::type() const {
108 return m_ptr.tv->m_type;
111 inline const TypedValue* member_rval::tv_ptr() const {
112 return m_ptr.tv;
115 inline TypedValue member_rval::tv() const {
116 return *m_ptr.tv;
119 inline member_rval::ptr_u member_rval::elem() const {
120 return m_ptr;
123 ///////////////////////////////////////////////////////////////////////////////