From 8c8503b03f8eb0d6be1f7f8b4d745d5972c5bc43 Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Wed, 7 Nov 2018 18:14:28 +0200 Subject: [PATCH] Bug 1466449 addendum - Turn jArray from a struct to class and make it have a constructor from nullptr. r=smaug. Simple adding a constructor from nullptr did not compile without turning jArray all the way to a class instead of struct. --- parser/html/jArray.h | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/parser/html/jArray.h b/parser/html/jArray.h index b626e4e0291e..ff79bfb1b892 100644 --- a/parser/html/jArray.h +++ b/parser/html/jArray.h @@ -48,9 +48,17 @@ struct staticJArray }; template -struct jArray +class autoJArray; + +template +class jArray { + friend class autoJArray; + +private: T* arr; + +public: L length; static jArray newJArray(L const len) { @@ -77,6 +85,23 @@ struct jArray arr = (T*)other.arr; length = other.length; } + MOZ_IMPLICIT jArray(decltype(nullptr)) + : arr(nullptr) + , length(0) + { + } + jArray() + : arr(nullptr) + , length(0) + { + } + +private: + jArray(T* aArr, L aLength) + : arr(aArr) + , length(aLength) + { + } }; template