Make bitwise_expression forwards compatible
Skip syms for tmath Skip more syms Add casting back for cast_expression. Disable cast test on Nim < 1.0.0 Skip more syms for cast expressions on Nim < 1.0.0
This commit is contained in:
parent
aa1086fae3
commit
208098b3eb
3 changed files with 18 additions and 5 deletions
|
|
@ -258,7 +258,7 @@ proc processParenthesizedExpr(exprParser: ExprParser, node: TSNode, typeofNode:
|
|||
result.add(exprParser.processTSNode(node[i], typeofNode))
|
||||
|
||||
proc processCastExpression(exprParser: ExprParser, node: TSNode, typeofNode: var PNode): PNode =
|
||||
result = nkCall.newTree(
|
||||
result = nkCast.newTree(
|
||||
exprParser.processTSNode(node[0], typeofNode),
|
||||
exprParser.processTSNode(node[1], typeofNode)
|
||||
)
|
||||
|
|
@ -455,7 +455,9 @@ proc processTSNode(exprParser: ExprParser, node: TSNode, typeofNode: var PNode):
|
|||
result = exprParser.processParenthesizedExpr(node, typeofNode)
|
||||
of "sizeof_expression":
|
||||
result = exprParser.processSizeofExpression(node, typeofNode)
|
||||
of "bitwise_expression", "equality_expression":
|
||||
# binary_expression from the new treesitter upgrade should work here
|
||||
# once we upgrade
|
||||
of "bitwise_expression", "equality_expression", "binary_expression":
|
||||
result = exprParser.processBitwiseExpression(node, typeofNode)
|
||||
of "math_expression":
|
||||
result = exprParser.processMathExpression(node, typeofNode)
|
||||
|
|
@ -497,4 +499,4 @@ proc parseCExpression*(state: NimState, code: string, name = ""): PNode =
|
|||
result = newNode(nkNone)
|
||||
except Exception as e:
|
||||
techo "UNEXPECTED EXCEPTION: ", e.msg
|
||||
result = newNode(nkNone)
|
||||
result = newNode(nkNone)
|
||||
|
|
|
|||
|
|
@ -3,11 +3,16 @@ import macros, os, sets, strutils
|
|||
import nimterop/[cimport]
|
||||
|
||||
static:
|
||||
# Skip casting on lower nim compilers because
|
||||
# the VM does not support it
|
||||
when (NimMajor, NimMinor, NimPatch) < (1, 0, 0):
|
||||
cSkipSymbol @["CASTEXPR"]
|
||||
cDebug()
|
||||
|
||||
const
|
||||
path = currentSourcePath.parentDir() / "include" / "tast2.h"
|
||||
|
||||
|
||||
when defined(HEADER):
|
||||
cDefine("HEADER")
|
||||
const
|
||||
|
|
@ -118,7 +123,9 @@ assert BINEXPR == 5
|
|||
assert BOOL == true
|
||||
assert MATHEXPR == -99
|
||||
assert ANDEXPR == 96
|
||||
assert CASTEXPR == 34.chr
|
||||
|
||||
when (NimMajor, NimMinor, NimPatch) >= (1, 0, 0):
|
||||
assert CASTEXPR == 34.chr
|
||||
|
||||
assert TRICKYSTR == "N\x1C\nfoo\x00\'\"\c\v\a\b\e\f\t\\\\?bar"
|
||||
assert NULLCHAR == '\0'
|
||||
|
|
@ -453,4 +460,4 @@ checkPragmas(nested, pHeaderImpBy)
|
|||
|
||||
when defined(HEADER):
|
||||
assert sitest1(5) == 10
|
||||
assert sitest1(10) == 20
|
||||
assert sitest1(10) == 20
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@ when defined(windows):
|
|||
complex = object
|
||||
|
||||
static:
|
||||
when (NimMajor, NimMinor, NimPatch) < (1, 0, 0):
|
||||
cSkipSymbol @["mingw_choose_expr", "EXCEPTION_DEFINED", "COMPLEX_DEFINED", "matherr", "HUGE", "FP_ILOGB0", "FP_ILOGBNAN"]
|
||||
else:
|
||||
cSkipSymbol @["mingw_choose_expr", "EXCEPTION_DEFINED", "COMPLEX_DEFINED", "matherr", "HUGE"]
|
||||
cDebug()
|
||||
cDisableCaching()
|
||||
cAddStdDir()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue