Bug 1529823 - Remove untagged tuple. r=Yoric

Untagged tuple is not used in multipart format and entropy format.

Differential Revision: https://phabricator.services.mozilla.com/D20776

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tooru Fujisawa 2019-02-24 03:34:46 +00:00
Родитель 765b149359
Коммит 7f54ff4d1d
5 изменённых файлов: 0 добавлений и 49 удалений

Просмотреть файл

@ -41,7 +41,6 @@ class BinASTParser : public BinASTParserPerTokenizer<Tok> {
using BinFields = typename Tokenizer::BinFields; using BinFields = typename Tokenizer::BinFields;
using AutoList = typename Tokenizer::AutoList; using AutoList = typename Tokenizer::AutoList;
using AutoTaggedTuple = typename Tokenizer::AutoTaggedTuple; using AutoTaggedTuple = typename Tokenizer::AutoTaggedTuple;
using AutoTuple = typename Tokenizer::AutoTuple;
using Chars = typename Tokenizer::Chars; using Chars = typename Tokenizer::Chars;
public: public:

Просмотреть файл

@ -54,7 +54,6 @@ class BinASTParserPerTokenizer : public BinASTParserBase,
using AutoList = typename Tokenizer::AutoList; using AutoList = typename Tokenizer::AutoList;
using AutoTaggedTuple = typename Tokenizer::AutoTaggedTuple; using AutoTaggedTuple = typename Tokenizer::AutoTaggedTuple;
using AutoTuple = typename Tokenizer::AutoTuple;
using BinFields = typename Tokenizer::BinFields; using BinFields = typename Tokenizer::BinFields;
using Chars = typename Tokenizer::Chars; using Chars = typename Tokenizer::Chars;

Просмотреть файл

@ -114,7 +114,6 @@ hpp:
using BinFields = typename Tokenizer::BinFields; using BinFields = typename Tokenizer::BinFields;
using AutoList = typename Tokenizer::AutoList; using AutoList = typename Tokenizer::AutoList;
using AutoTaggedTuple = typename Tokenizer::AutoTaggedTuple; using AutoTaggedTuple = typename Tokenizer::AutoTaggedTuple;
using AutoTuple = typename Tokenizer::AutoTuple;
using Chars = typename Tokenizer::Chars; using Chars = typename Tokenizer::Chars;
public: public:

Просмотреть файл

@ -41,7 +41,6 @@ const uint32_t MAX_NUMBER_OF_STRINGS = 32768;
using AutoList = BinTokenReaderMultipart::AutoList; using AutoList = BinTokenReaderMultipart::AutoList;
using AutoTaggedTuple = BinTokenReaderMultipart::AutoTaggedTuple; using AutoTaggedTuple = BinTokenReaderMultipart::AutoTaggedTuple;
using AutoTuple = BinTokenReaderMultipart::AutoTuple;
using CharSlice = BinaryASTSupport::CharSlice; using CharSlice = BinaryASTSupport::CharSlice;
using Chars = BinTokenReaderMultipart::Chars; using Chars = BinTokenReaderMultipart::Chars;
@ -359,13 +358,6 @@ BinTokenReaderMultipart::readSkippableSubTree() {
return BinTokenReaderBase::SkippableSubTree(start, byteLen); return BinTokenReaderBase::SkippableSubTree(start, byteLen);
} }
// Untagged tuple:
// - contents (specified by the higher-level grammar);
JS::Result<Ok> BinTokenReaderMultipart::enterUntaggedTuple(AutoTuple& guard) {
guard.init();
return Ok();
}
// Tagged tuples: // Tagged tuples:
// - uint32_t index in table [grammar]; // - uint32_t index in table [grammar];
// - content (specified by the higher-level grammar); // - content (specified by the higher-level grammar);
@ -483,21 +475,6 @@ JS::Result<Ok> BinTokenReaderMultipart::AutoTaggedTuple::done() {
return Ok(); return Ok();
} }
BinTokenReaderMultipart::AutoTuple::AutoTuple(BinTokenReaderMultipart& reader)
: AutoBase(reader) {}
JS::Result<Ok> BinTokenReaderMultipart::AutoTuple::done() {
MOZ_ASSERT(initialized_);
initialized_ = false;
if (reader_.hasRaisedError()) {
// Already errored, no need to check further.
return reader_.cx_->alreadyReportedError();
}
// Check suffix.
return Ok();
}
} // namespace frontend } // namespace frontend
} // namespace js } // namespace js

Просмотреть файл

@ -33,7 +33,6 @@ namespace frontend {
class MOZ_STACK_CLASS BinTokenReaderMultipart : public BinTokenReaderBase { class MOZ_STACK_CLASS BinTokenReaderMultipart : public BinTokenReaderBase {
public: public:
class AutoList; class AutoList;
class AutoTuple;
class AutoTaggedTuple; class AutoTaggedTuple;
using CharSlice = BinaryASTSupport::CharSlice; using CharSlice = BinaryASTSupport::CharSlice;
@ -174,19 +173,6 @@ class MOZ_STACK_CLASS BinTokenReaderMultipart : public BinTokenReaderBase {
BinKind& tag, BinTokenReaderMultipart::BinFields& fields, BinKind& tag, BinTokenReaderMultipart::BinFields& fields,
AutoTaggedTuple& guard); AutoTaggedTuple& guard);
/**
* Start reading an untagged tuple.
*
* @param guard (OUT) A guard, ensuring that we read the tuple correctly.
*
* The `guard` is dedicated to ensuring that reading the list has consumed
* exactly all the bytes from that tuple. The `guard` MUST therefore be
* destroyed at the point where the caller has reached the end of the tuple.
* If the caller has consumed too few/too many bytes, this will be reported
* in the call go `guard.done()`.
*/
MOZ_MUST_USE JS::Result<Ok> enterUntaggedTuple(AutoTuple& guard);
/** /**
* Read a single unsigned long. * Read a single unsigned long.
*/ */
@ -275,15 +261,6 @@ class MOZ_STACK_CLASS BinTokenReaderMultipart : public BinTokenReaderBase {
MOZ_MUST_USE JS::Result<Ok> done(); MOZ_MUST_USE JS::Result<Ok> done();
}; };
// Guard class used to ensure that `readTuple` is used properly.
class MOZ_STACK_CLASS AutoTuple : public AutoBase {
public:
explicit AutoTuple(BinTokenReaderMultipart& reader);
// Check that we have properly read to the end of the tuple.
MOZ_MUST_USE JS::Result<Ok> done();
};
// Compare a `Chars` and a string literal (ONLY a string literal). // Compare a `Chars` and a string literal (ONLY a string literal).
template <size_t N> template <size_t N>
static bool equals(const Chars& left, const char (&right)[N]) { static bool equals(const Chars& left, const char (&right)[N]) {