git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge remote-tracking branch 'pure11/pure11' into native
1a79a34Andy Arvanitis
pcc/runtime/purescript.cc+3
@@ -17,6 +17,9 @@
17
17
18namespace PureScript {
18namespace PureScript {
19
19
20+any::closure::~closure() {}
21+any::eff_closure::~eff_closure() {}
22+
20#define RETURN_VALUE(TAG, ACCESSOR, INDIRECTION) \
23#define RETURN_VALUE(TAG, ACCESSOR, INDIRECTION) \
21 const any& variant = unthunkVariant(*this); \
24 const any& variant = unthunkVariant(*this); \
22 assert(variant.tag == TAG); \
25 assert(variant.tag == TAG); \
pcc/runtime/purescript.hh+3−8
@@ -45,6 +45,7 @@ namespace PureScript {
45
45
46using cstring = const char *;
46using cstring = const char *;
47using std::nullptr_t;
47using std::nullptr_t;
48+using std::runtime_error;
48
49
49namespace Private {
50namespace Private {
50 struct symbol_generator_anchor_t {};
51 struct symbol_generator_anchor_t {};
@@ -68,12 +69,6 @@ using symbol_t = const Private::symbol_generator_anchor_t *;
68 }
69 }
69#define symbol(S) (&Private::symbol_generator<::PureScript::Private::Symbol::S_ ## S>::anchor)
70#define symbol(S) (&Private::symbol_generator<::PureScript::Private::Symbol::S_ ## S>::anchor)
70
71
71−// Workaround for missing C++11 version in gcc
72−class runtime_error : public std::runtime_error {
73−public:
74− runtime_error(const char message[]) : std::runtime_error(std::string(message)) {}
75−};
76−
77constexpr bool undefined = false;
72constexpr bool undefined = false;
78
73
79// Not a real limit, just used for simpler accessors
74// Not a real limit, just used for simpler accessors
@@ -128,7 +123,7 @@ class any {
128 class closure {
123 class closure {
129 public:
124 public:
130 virtual auto operator()(const any&) const -> any = 0;
125 virtual auto operator()(const any&) const -> any = 0;
131− virtual ~closure() {}
126+ virtual ~closure();
132 };
127 };
133
128
134 template <typename T>
129 template <typename T>
@@ -144,7 +139,7 @@ class any {
144 class eff_closure {
139 class eff_closure {
145 public:
140 public:
146 virtual auto operator()() const -> any = 0;
141 virtual auto operator()() const -> any = 0;
147− virtual ~eff_closure() {}
142+ virtual ~eff_closure();
148 };
143 };
149
144
150 template <typename T>
145 template <typename T>
pcc/support/Makefile+1−1
@@ -41,7 +41,7 @@ ifeq ("$(wildcard $(PSC_PACKAGE))","")
41 PSC_PACKAGE := $(PSC_PKG_BIN)
41 PSC_PACKAGE := $(PSC_PKG_BIN)
42endif
42endif
43
43
44−PACKAGE_SOURCES = $(shell $(PSC_PACKAGE) sources)
44+PACKAGE_SOURCES = $(subst \,/,$(shell $(PSC_PACKAGE) sources))
45PURESCRIPT_PKGS := $(firstword $(subst /, ,$(PACKAGE_SOURCES)))
45PURESCRIPT_PKGS := $(firstword $(subst /, ,$(PACKAGE_SOURCES)))
46
46
47## Not all environments support globstar (** dir pattern)
47## Not all environments support globstar (** dir pattern)
src/Language/PureScript/Pretty/Cpp.hs+4−2
@@ -106,16 +106,18 @@ literals = mkPattern' match
106 , return $ T.intercalate ", " es
106 , return $ T.intercalate ", " es
107 , return " }"
107 , return " }"
108 ]
108 ]
109+ match (CppMapLiteral Record []) = return "nullptr"
109 match (CppMapLiteral _ ps) = mconcat <$> sequence
110 match (CppMapLiteral _ ps) = mconcat <$> sequence
110 [ return $ runType (mapType $ length ps + 1) <> "{{\n"
111 [ return $ runType (mapType $ length ps + 1) <> "{{\n"
111 , withIndent $ do
112 , withIndent $ do
113+ let ps' = ps ++ [(CppVar "nullptr", CppVar "nullptr")]
112 cpps <-
114 cpps <-
113− forM ps $ \(key, value) -> do
115+ forM ps' $ \(key, value) -> do
114 value' <- prettyPrintCpp' value
116 value' <- prettyPrintCpp' value
115 key' <- prettyPrintCpp' key
117 key' <- prettyPrintCpp' key
116 return $ "{ " <> key' <> ", " <> value' <> " }"
118 return $ "{ " <> key' <> ", " <> value' <> " }"
117 indentString <- currentIndent
119 indentString <- currentIndent
118− return $ T.intercalate ", \n" $ map (indentString <>) (cpps ++ ["{ nullptr, nullptr }"])
120+ return $ T.intercalate ", \n" $ map (indentString <>) cpps
119 , return "\n"
121 , return "\n"
120 , currentIndent
122 , currentIndent
121 , return "}}"
123 , return "}}"