Add skippedSymbols for determining if a type has been skipped

This commit is contained in:
Joey Yakimowich-Payne 2020-04-23 20:20:05 -06:00
commit eaecf9ebdf
3 changed files with 19 additions and 12 deletions

View file

@ -41,6 +41,7 @@ proc getOverrideOrSkip(gState: State, node: TSNode, origname: string, kind: NimS
result = pnode[0][0] result = pnode[0][0]
else: else:
gecho &"\n# $1'{origname}' skipped" % skind gecho &"\n# $1'{origname}' skipped" % skind
gState.skippedSyms.incl origname
if gState.debug: if gState.debug:
gState.skipStr &= &"\n{gState.getNodeVal(node)}" gState.skipStr &= &"\n{gState.getNodeVal(node)}"
@ -99,6 +100,7 @@ proc newConstDef(gState: State, node: TSNode, fname = "", fval = ""): PNode =
fval fval
else: else:
gState.getNodeVal(node[1]) gState.getNodeVal(node[1])
var valident = newNode(nkNone) var valident = newNode(nkNone)
withCodeAst(val, gState.mode): withCodeAst(val, gState.mode):
@ -151,6 +153,7 @@ proc newConstDef(gState: State, node: TSNode, fname = "", fval = ""): PNode =
gecho &"# const '{origname}' is duplicate, skipped" gecho &"# const '{origname}' is duplicate, skipped"
else: else:
gecho &"# const '{origname}' has invalid value '{val}'" gecho &"# const '{origname}' has invalid value '{val}'"
gState.skippedSyms.incl origname
proc addConst(gState: State, node: TSNode) = proc addConst(gState: State, node: TSNode) =
# Add a const to the AST # Add a const to the AST

View file

@ -45,6 +45,7 @@ proc getExprIdent*(gState: State, identName: string, kind = nskConst, parent = "
## ##
## Returns PNode(nkNone) if the identifier is blank ## Returns PNode(nkNone) if the identifier is blank
result = newNode(nkNone) result = newNode(nkNone)
if identName notin gState.skippedSyms:
var ident = identName var ident = identName
if ident != "_": if ident != "_":
# Process the identifier through cPlugin # Process the identifier through cPlugin

View file

@ -76,6 +76,9 @@ type
# All const names for enum casting # All const names for enum casting
constIdentifiers*: HashSet[string] constIdentifiers*: HashSet[string]
# All symbols that have been skipped
skippedSyms*: HashSet[string]
# Legacy ast fields, remove when ast2 becomes default # Legacy ast fields, remove when ast2 becomes default
constStr*, enumStr*, procStr*, typeStr*: string constStr*, enumStr*, procStr*, typeStr*: string