git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix dict_t missing key exceptions
commita1c986a1aeb61f1cf14984381bb90de7cc6a04dd authorAndy Arvanitis <andyarvanitis@gmail.com> dateThu 20 Sep 2018, 21:33 (8 years ago) parentcc1a7c8
2 files changed+6−2
runtime/string_literal_dict.h+4 src/CodeGen/Cpp/Printer.hs+2−2
runtime/string_literal_dict.h+4
@@ -55,6 +55,10 @@ class string_literal_dict_t : public std::vector<std::pair<const char *, T>> {
5555 return null();
5656 }
5757
58+ auto at(const char key[]) const -> const T& {
59+ return (*this)[key];
60+ }
61+
5862 auto operator[](const char key[]) -> T& {
5963 const auto end = this->end();
6064 for (auto it = this->begin(); it != end; it++) {
src/CodeGen/Cpp/Printer.hs+2−2
@@ -444,8 +444,8 @@ interfaceSource mn exports foreigns =
444444 identToCpp foreign' <>
445445 "() -> " <> varDecl <> " { " <>
446446 dispatchOnceBegin <>
447− foreignDict <> "()[" <>
448− (stringLiteral . mkString $ runIdent foreign') <> "]; " <>
447+ foreignDict <> "().at(" <>
448+ (stringLiteral . mkString $ runIdent foreign') <> "); " <>
449449 dispatchOnceEnd <>
450450 " };\n") <$> foreigns) <>
451451 "\n" <>