summaryrefslogtreecommitdiff
path: root/src/emscripten-optimizer/simple_ast.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2019-01-15 13:20:05 -0800
committerGitHub <noreply@github.com>2019-01-15 13:20:05 -0800
commitd24427dcc8cd6e0dbcd8c302eb2e8a5d0d6fdead (patch)
tree37575895001e5dd9509c5c42fd539253516e21fd /src/emscripten-optimizer/simple_ast.h
parent45714b5fc6cf14c112bc4f188aca427464ab69d8 (diff)
downloadbinaryen-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/emscripten-optimizer/simple_ast.h')
-rw-r--r--src/emscripten-optimizer/simple_ast.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/emscripten-optimizer/simple_ast.h b/src/emscripten-optimizer/simple_ast.h
index 9cbe7616c..de8122ba1 100644
--- a/src/emscripten-optimizer/simple_ast.h
+++ b/src/emscripten-optimizer/simple_ast.h
@@ -112,7 +112,7 @@ struct Value {
AssignName_ = 7
};
- Type type;
+ Type type = Null;
typedef std::unordered_map<IString, Ref> ObjectStorage;
@@ -131,14 +131,14 @@ struct Value {
};
// constructors all copy their input
- Value() : type(Null), num(0) {}
- explicit Value(const char *s) : type(Null) {
+ Value() {}
+ explicit Value(const char *s) {
setString(s);
}
- explicit Value(double n) : type(Null) {
+ explicit Value(double n) {
setNumber(n);
}
- explicit Value(ArrayStorage &a) : type(Null) {
+ explicit Value(ArrayStorage &a) {
setArray();
*arr = a;
}
@@ -544,15 +544,16 @@ void traverseFunctions(Ref ast, std::function<void (Ref)> visit);
struct JSPrinter {
bool pretty, finalize;
- char *buffer;
- size_t size, used;
+ char *buffer = nullptr;
+ size_t size = 0;
+ size_t used = 0;
- int indent;
- bool possibleSpace; // add a space to separate identifiers
+ int indent = 0;
+ bool possibleSpace = false; // add a space to separate identifiers
Ref ast;
- JSPrinter(bool pretty_, bool finalize_, Ref ast_) : pretty(pretty_), finalize(finalize_), buffer(0), size(0), used(0), indent(0), possibleSpace(false), ast(ast_) {}
+ JSPrinter(bool pretty_, bool finalize_, Ref ast_) : pretty(pretty_), finalize(finalize_), ast(ast_) {}
~JSPrinter() {
free(buffer);