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)
|
||||
let leftNode = gState.processTSNode(left, typeofNode)
|
||||
var tyNode = typeofNode
|
||||
|
||||
if typeofNode.isNil:
|
||||
typeofNode = nkCall.newTree(
|
||||
gState.getIdent("typeof"),
|
||||
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 nkCall.newTree(
|
||||
typeofNode,
|
||||
tyNode,
|
||||
rightNode
|
||||
)
|
||||
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
|
||||
# expression to the type of the first arg
|
||||
result = nkCall.newTree(
|
||||
typeofNode,
|
||||
tyNode,
|
||||
result
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ extern "C" {
|
|||
#define EQ4 AVAL < BVAL
|
||||
#define EQ5 AVAL != BVAL
|
||||
#define EQ6 AVAL == BVAL
|
||||
#define SX_NEAR_ZERO (1.0f / (1 << 28))
|
||||
|
||||
// testing integer out of long int range
|
||||
#define INT_FAST16_MIN (-9223372036854775807L-1)
|
||||
|
|
|
|||
|
|
@ -134,6 +134,8 @@ assert EQ4 == (AVAL < BVAL)
|
|||
assert EQ5 == (AVAL != BVAL)
|
||||
assert EQ6 == (AVAL == BVAL)
|
||||
|
||||
assert SX_NEAR_ZERO == 3.725290298461914e-09
|
||||
|
||||
assert SIZEOF == 1
|
||||
|
||||
assert COERCE == 645635670332'u64
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue