diff options
author | Ben Smith <binjimin@gmail.com> | 2017-06-12 16:10:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-12 16:10:17 -0700 |
commit | 194fbedf2065cc2ac09a4ead997256a8a8f8894a (patch) | |
tree | 472f10d5d4ec335e3adf39a85f49ca73a08a0280 /src/binding-hash.h | |
parent | 3377747c3fb159826c5bd6d4a70ee5e167c79552 (diff) | |
download | wabt-194fbedf2065cc2ac09a4ead997256a8a8f8894a.tar.gz wabt-194fbedf2065cc2ac09a4ead997256a8a8f8894a.tar.bz2 wabt-194fbedf2065cc2ac09a4ead997256a8a8f8894a.zip |
Use CamelCase names and member functions in ir.h (#492)
* Remove destroy_var; use destructor instead
* Add Var copy/move constructor/assignment operator.
Diffstat (limited to 'src/binding-hash.h')
-rw-r--r-- | src/binding-hash.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/binding-hash.h b/src/binding-hash.h index 6222a254..3b4cd7eb 100644 --- a/src/binding-hash.h +++ b/src/binding-hash.h @@ -26,14 +26,16 @@ namespace wabt { +struct Var; + struct Binding { - explicit Binding(int index) : index(index) { + explicit Binding(Index index) : index(index) { WABT_ZERO_MEMORY(loc); } - Binding(const Location& loc, int index) : loc(loc), index(index) {} + Binding(const Location& loc, Index index) : loc(loc), index(index) {} Location loc; - int index; + Index index; }; // This class derives from a C++ container, which is usually not advisable @@ -46,11 +48,13 @@ class BindingHash : public std::unordered_multimap<std::string, Binding> { void FindDuplicates(DuplicateCallback callback) const; - int FindIndex(const StringSlice& name) const { + Index FindIndex(const Var&) const; + + Index FindIndex(const StringSlice& name) const { auto iter = find(string_slice_to_string(name)); if (iter != end()) return iter->second.index; - return -1; + return kInvalidIndex; } private: |