Permalink
Browse files

Add Dict helper function

Reviewed By: ricklavoie

Differential Revision: D7203484

fbshipit-source-id: 7b528b636fc9a8b6da29abb1370485a6b554c0f5
  • Loading branch information...
WizKid authored and hhvm-bot committed Mar 16, 2018
1 parent f1c4db8 commit 6810730e5f3e9878da81b7776b53ad29fbafb48b
Showing with 8 additions and 0 deletions.
  1. +8 −0 hphp/runtime/base/type-variant.h
@@ -1545,6 +1545,14 @@ inline Array& forceToDict(Variant& var) {
return var.toArrRef();
}
inline Array& forceToDict(member_lval lval) {
auto const inner = lval.unboxed();
if (!isDictType(inner.type())) {
tvSet(make_tv<KindOfDict>(ArrayData::CreateDict()), inner);
}
return asArrRef(inner);
}
//////////////////////////////////////////////////////////////////////
ALWAYS_INLINE Variant empty_string_variant() {

0 comments on commit 6810730

Please sign in to comment.