on master help sign in
javascript: fix compares
c03e1b2raichoo
src/IRTS/CodegenJavaScript.hs+5−5
@@ -214,7 +214,7 @@ translateExpression _ (SOp op vars)
214 | LMod <- op
214 | LMod <- op
215 , (lhs:rhs:_) <- vars = translateBinaryOp "%" lhs rhs
215 , (lhs:rhs:_) <- vars = translateBinaryOp "%" lhs rhs
216 | LEq <- op
216 | LEq <- op
217− , (lhs:rhs:_) <- vars = translateBinaryOp "===" lhs rhs
217+ , (lhs:rhs:_) <- vars = translateBinaryOp "==" lhs rhs
218 | LLt <- op
218 | LLt <- op
219 , (lhs:rhs:_) <- vars = translateBinaryOp "<" lhs rhs
219 , (lhs:rhs:_) <- vars = translateBinaryOp "<" lhs rhs
220 | LLe <- op
220 | LLe <- op
@@ -233,7 +233,7 @@ translateExpression _ (SOp op vars)
233 | LFDiv <- op
233 | LFDiv <- op
234 , (lhs:rhs:_) <- vars = translateBinaryOp "/" lhs rhs
234 , (lhs:rhs:_) <- vars = translateBinaryOp "/" lhs rhs
235 | LFEq <- op
235 | LFEq <- op
236− , (lhs:rhs:_) <- vars = translateBinaryOp "===" lhs rhs
236+ , (lhs:rhs:_) <- vars = translateBinaryOp "==" lhs rhs
237 | LFLt <- op
237 | LFLt <- op
238 , (lhs:rhs:_) <- vars = translateBinaryOp "<" lhs rhs
238 , (lhs:rhs:_) <- vars = translateBinaryOp "<" lhs rhs
239 | LFLe <- op
239 | LFLe <- op
@@ -254,7 +254,7 @@ translateExpression _ (SOp op vars)
254 | LBMod <- op
254 | LBMod <- op
255 , (lhs:rhs:_) <- vars = translateBinaryOp "%" lhs rhs
255 , (lhs:rhs:_) <- vars = translateBinaryOp "%" lhs rhs
256 | LBEq <- op
256 | LBEq <- op
257− , (lhs:rhs:_) <- vars = translateBinaryOp "===" lhs rhs
257+ , (lhs:rhs:_) <- vars = translateBinaryOp "==" lhs rhs
258 | LBLt <- op
258 | LBLt <- op
259 , (lhs:rhs:_) <- vars = translateBinaryOp "<" lhs rhs
259 , (lhs:rhs:_) <- vars = translateBinaryOp "<" lhs rhs
260 | LBLe <- op
260 | LBLe <- op
@@ -330,12 +330,12 @@ translateCase modname _ (SDefaultCase e) =
330 createIfBlock "true" (translateExpression modname e)
330 createIfBlock "true" (translateExpression modname e)
331
331
332translateCase modname var (SConstCase cst e) =
332translateCase modname var (SConstCase cst e) =
333− let cond = var ++ " === " ++ translateConstant cst in
333+ let cond = var ++ " == " ++ translateConstant cst in
334 createIfBlock cond (translateExpression modname e)
334 createIfBlock cond (translateExpression modname e)
335
335
336translateCase modname var (SConCase a i name vars e) =
336translateCase modname var (SConCase a i name vars e) =
337 let isCon = var ++ " instanceof __IDR__.Con"
337 let isCon = var ++ " instanceof __IDR__.Con"
338− isI = show i ++ " === " ++ var ++ ".i"
338+ isI = show i ++ " == " ++ var ++ ".i"
339 params = intercalate "," $ map (("__var_" ++) . show) [a..(a+length vars)]
339 params = intercalate "," $ map (("__var_" ++) . show) [a..(a+length vars)]
340 args = ".apply(this," ++ var ++ ".vars)"
340 args = ".apply(this," ++ var ++ ".vars)"
341 f b =
341 f b =