on master help sign in
Make instanceof check safer, check if it's an object before using instance of
53389ffEvan Czaplicki
compiler/Generate/JavaScript/Helpers.hs+2−1
@@ -31,6 +31,7 @@ dotSep vars =
31obj = dotSep . split
31obj = dotSep . split
32
32
33equal a b = InfixExpr () OpStrictEq a b
33equal a b = InfixExpr () OpStrictEq a b
34+instanceof tipe x =
34−instanceof tipe x = InfixExpr () OpInstanceof x (ref tipe)
35+ InfixExpr () OpLAnd (typeof "object" x) (InfixExpr () OpInstanceof x (ref tipe))
35typeof tipe x = equal (PrefixExpr () PrefixTypeof x) (string tipe)
36typeof tipe x = equal (PrefixExpr () PrefixTypeof x) (string tipe)
36member field x = InfixExpr () OpIn (string field) x
37member field x = InfixExpr () OpIn (string field) x