Commit 60f1b75e

60f1b75ea8d0Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 4 files · +2 added · ~2 modified

Description

Merge pull request #226 from ryanseys/rs-node-source-file

feat(parse,codegen): support SourceFileNode (FILE)

Details

Commit
60f1b75ea8d0
Parent
650ced6a69be
Merge parent
af9d40dd3174

spinel_codegen.rbmodifiedView file

@@ -1665,6 +1665,9 @@
16651665 if t == "StringNode"
16661666 return "string"
16671667 end
1668+ if t == "SourceFileNode"
1669+ return "string"
1670+ end
16681671 if t == "SymbolNode"
16691672 return "symbol"
16701673 end
@@ -16134,6 +16137,12 @@
1613416137 if t == "SourceLineNode"
1613516138 return @nd_value[nid].to_s
1613616139 end
16140+ if t == "SourceFileNode"
16141+ # __FILE__ — parser populated @nd_content with the toplevel
16142+ # script path. (Inlined-require call sites all see the same
16143+ # path; documented limitation in test/source_file.rb.)
16144+ return c_string_literal(@nd_content[nid])
16145+ end
1613716146 if t == "ArgumentsNode"
1613816147 arg_ids = parse_id_list(@nd_args[nid])
1613916148 if arg_ids.length > 0