on master help sign in
javascript: removed unoptimizable JSRaw
commite89734d8f95c3bceaabf1eaf3e44bdaaa2c0cc63 authorraichoo <raichoo@googlemail.com> dateThu 13 Feb 2014, 20:47 (13 years ago) parent82750fd
1 file changed+4−1
src/IRTS/CodegenJavaScript.hs+4−1
src/IRTS/CodegenJavaScript.hs+4−1
@@ -129,6 +129,9 @@ compileJS (JSError exc) =
129129compileJS (JSBinOp op lhs rhs) =
130130 compileJS lhs ++ " " ++ op ++ " " ++ compileJS rhs
131131
132+compileJS (JSPreOp op val) =
133+ op ++ compileJS val
134+
132135compileJS (JSProj obj field)
133136 | JSFunction {} <- obj =
134137 concat ["(", compileJS obj, ").", field]
@@ -1594,7 +1597,7 @@ translateExpression (SOp op vars)
15941597 | (LASHR _) <- op
15951598 , (lhs:rhs:_) <- vars = translateBinaryOp ">>" rhs lhs
15961599 | (LCompl _) <- op
1597− , (arg:_) <- vars = JSRaw $ '~' : translateVariableName arg
1600+ , (arg:_) <- vars = JSPreOp "~" (JSVar arg)
15981601
15991602 | LStrConcat <- op
16001603 , (lhs:rhs:_) <- vars = translateBinaryOp "+" lhs rhs