Compare commits
1 commit
master
...
fix_cast_e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f6cec613f |
3 changed files with 16 additions and 3 deletions
|
|
@ -379,18 +379,28 @@ proc processBinaryExpression(gState: State, node: TSNode, typeofNode: var PNode)
|
||||||
|
|
||||||
result.add gState.getIdent(nimSym)
|
result.add gState.getIdent(nimSym)
|
||||||
let leftNode = gState.processTSNode(left, typeofNode)
|
let leftNode = gState.processTSNode(left, typeofNode)
|
||||||
|
var tyNode = typeofNode
|
||||||
|
|
||||||
if typeofNode.isNil:
|
if typeofNode.isNil:
|
||||||
typeofNode = nkCall.newTree(
|
typeofNode = nkCall.newTree(
|
||||||
gState.getIdent("typeof"),
|
gState.getIdent("typeof"),
|
||||||
leftNode
|
leftNode
|
||||||
)
|
)
|
||||||
|
tyNode = typeofNode
|
||||||
|
|
||||||
let rightNode = gState.processTSNode(right, typeofNode)
|
# Special case of setting the shift left/right type
|
||||||
|
# to be the type of the direct left operand
|
||||||
|
if binarySym in [">>", "<<"]:
|
||||||
|
tyNode = nkCall.newTree(
|
||||||
|
gState.getIdent("typeof"),
|
||||||
|
leftNode
|
||||||
|
)
|
||||||
|
|
||||||
|
let rightNode = gState.processTSNode(right, tyNode)
|
||||||
|
|
||||||
result.add leftNode
|
result.add leftNode
|
||||||
result.add nkCall.newTree(
|
result.add nkCall.newTree(
|
||||||
typeofNode,
|
tyNode,
|
||||||
rightNode
|
rightNode
|
||||||
)
|
)
|
||||||
if binarySym == "/":
|
if binarySym == "/":
|
||||||
|
|
@ -399,7 +409,7 @@ proc processBinaryExpression(gState: State, node: TSNode, typeofNode: var PNode)
|
||||||
# So we need to emulate C here and cast the whole
|
# So we need to emulate C here and cast the whole
|
||||||
# expression to the type of the first arg
|
# expression to the type of the first arg
|
||||||
result = nkCall.newTree(
|
result = nkCall.newTree(
|
||||||
typeofNode,
|
tyNode,
|
||||||
result
|
result
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ extern "C" {
|
||||||
#define EQ4 AVAL < BVAL
|
#define EQ4 AVAL < BVAL
|
||||||
#define EQ5 AVAL != BVAL
|
#define EQ5 AVAL != BVAL
|
||||||
#define EQ6 AVAL == BVAL
|
#define EQ6 AVAL == BVAL
|
||||||
|
#define SX_NEAR_ZERO (1.0f / (1 << 28))
|
||||||
|
|
||||||
// testing integer out of long int range
|
// testing integer out of long int range
|
||||||
#define INT_FAST16_MIN (-9223372036854775807L-1)
|
#define INT_FAST16_MIN (-9223372036854775807L-1)
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,8 @@ assert EQ4 == (AVAL < BVAL)
|
||||||
assert EQ5 == (AVAL != BVAL)
|
assert EQ5 == (AVAL != BVAL)
|
||||||
assert EQ6 == (AVAL == BVAL)
|
assert EQ6 == (AVAL == BVAL)
|
||||||
|
|
||||||
|
assert SX_NEAR_ZERO == 3.725290298461914e-09
|
||||||
|
|
||||||
assert SIZEOF == 1
|
assert SIZEOF == 1
|
||||||
|
|
||||||
assert COERCE == 645635670332'u64
|
assert COERCE == 645635670332'u64
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue