From d24427dcc8cd6e0dbcd8c302eb2e8a5d0d6fdead Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 15 Jan 2019 13:20:05 -0800 Subject: Code style improvements (#1868) * Use modern T p = v; notation to initialize class fields * Use modern X() = default; notation for empty class constructors --- src/wasm-s-parser.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/wasm-s-parser.h') diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index 0845fa70e..ef6e8d36b 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -44,24 +44,25 @@ public: class Element { typedef ArenaVector List; - bool isList_; + bool isList_ = true; List list_; cashew::IString str_; bool dollared_; bool quoted_; public: - Element(MixedArena& allocator) : isList_(true), list_(allocator), line(-1), col(-1), startLoc(nullptr), endLoc(nullptr) {} + Element(MixedArena& allocator) : list_(allocator) {} bool isList() const { return isList_; } bool isStr() const { return !isList_; } bool dollared() const { return isStr() && dollared_; } bool quoted() const { return isStr() && quoted_; } - size_t line, col; + size_t line = -1; + size_t col = -1; // original locations at the start/end of the S-Expression list - SourceLocation* startLoc; - SourceLocation* endLoc; + SourceLocation* startLoc = nullptr; + SourceLocation* endLoc = nullptr; // list methods List& list(); @@ -88,7 +89,7 @@ class SExpressionParser { char* input; size_t line; char* lineStart; - SourceLocation* loc; + SourceLocation* loc = nullptr; MixedArena allocator; @@ -114,7 +115,7 @@ class SExpressionWasmBuilder { std::vector functionTypeNames; std::vector globalNames; int functionCounter; - int globalCounter; + int globalCounter = 0; std::map functionTypes; // we need to know function return types before we parse their contents std::unordered_map debugInfoFileIndices; -- cgit v1.2.3