diff options
author | Alon Zakai <alonzakai@gmail.com> | 2019-01-15 13:20:05 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-15 13:20:05 -0800 |
commit | d24427dcc8cd6e0dbcd8c302eb2e8a5d0d6fdead (patch) | |
tree | 37575895001e5dd9509c5c42fd539253516e21fd /src/wasm-s-parser.h | |
parent | 45714b5fc6cf14c112bc4f188aca427464ab69d8 (diff) | |
download | binaryen-d24427dcc8cd6e0dbcd8c302eb2e8a5d0d6fdead.tar.gz binaryen-d24427dcc8cd6e0dbcd8c302eb2e8a5d0d6fdead.tar.bz2 binaryen-d24427dcc8cd6e0dbcd8c302eb2e8a5d0d6fdead.zip |
Code style improvements (#1868)
* Use modern T p = v; notation to initialize class fields
* Use modern X() = default; notation for empty class constructors
Diffstat (limited to 'src/wasm-s-parser.h')
-rw-r--r-- | src/wasm-s-parser.h | 15 |
1 files changed, 8 insertions, 7 deletions
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<Element*> 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<Name> functionTypeNames; std::vector<Name> globalNames; int functionCounter; - int globalCounter; + int globalCounter = 0; std::map<Name, Type> functionTypes; // we need to know function return types before we parse their contents std::unordered_map<cashew::IString, Index> debugInfoFileIndices; |