git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Support record updates on records with field named hasOwnProperty

Previously this would fail.

commit4f2959aab1c81136e7b63f51e9beffe6a8052a0c authorrightfold <rightfold@gmail.com> dateSun 16 Oct 2016, 14:22 (10 years ago) parentc0ec830
2 files changed+6−1
examples/passing/HasOwnProperty.purs+5 src/Language/PureScript/CodeGen/JS.hs+1−1
examples/passing/HasOwnProperty.pursnew file+5
@@ -0,0 +1,5 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console (log)
4+
5+main = log ({hasOwnProperty: "Hi"} {hasOwnProperty = "Done"}).hasOwnProperty
src/Language/PureScript/CodeGen/JS.hs+1−1
@@ -291,7 +291,7 @@ moduleToJs (Module coms mn imps exps foreigns decls) foreign_ =
291291 evaluate = JSVariableIntroduction Nothing evaluatedObj (Just obj)
292292 objAssign = JSVariableIntroduction Nothing newObj (Just $ JSObjectLiteral Nothing [])
293293 copy = JSForIn Nothing key jsEvaluatedObj $ JSBlock Nothing [JSIfElse Nothing cond assign Nothing]
294− cond = JSApp Nothing (JSAccessor Nothing "hasOwnProperty" jsEvaluatedObj) [jsKey]
294+ cond = JSApp Nothing (JSAccessor Nothing "call" (JSAccessor Nothing "hasOwnProperty" (JSObjectLiteral Nothing []))) [jsEvaluatedObj, jsKey]
295295 assign = JSBlock Nothing [JSAssignment Nothing (JSIndexer Nothing jsKey jsNewObj) (JSIndexer Nothing jsKey jsEvaluatedObj)]
296296 stToAssign (s, js) = JSAssignment Nothing (accessorString s jsNewObj) js
297297 extend = map stToAssign sts