class Prism::SourceFileNode
表示使用 `__FILE__` 关键字。
__FILE__ ^^^^^^^^
属性
filepath[R]
表示正在解析的文件路径。这直接对应于传递给各种 `Prism::parse*` API 的 `filepath` 选项。
公共类方法
new(source, node_id, location, flags, filepath) 点击切换源代码
初始化一个新的 SourceFileNode
节点。
# File prism/node.rb, line 16509 def initialize(source, node_id, location, flags, filepath) @source = source @node_id = node_id @location = location @flags = flags @filepath = filepath end
type() 点击切换源代码
返回此节点类型的符号表示。请参见 ‘Node::type’。
# File prism/node.rb, line 16584 def self.type :source_file_node end
公共实例方法
===(other) 点击切换源代码
实现节点的 case-equality。这实际上是 ==,但不比较位置的值。仅检查位置是否存在。
# File prism/node.rb, line 16590 def ===(other) other.is_a?(SourceFileNode) && (flags === other.flags) && (filepath === other.filepath) end
accept(visitor) 点击切换源代码
def accept: (Visitor
visitor) -> void
# File prism/node.rb, line 16518 def accept(visitor) visitor.visit_source_file_node(self) end
child_nodes() 点击切换源代码
def child_nodes
: () -> Array[nil | Node]
# File prism/node.rb, line 16523 def child_nodes [] end
也别名为:deconstruct
comment_targets() 点击切换源代码
def comment_targets
: () -> Array[Node | Location]
# File prism/node.rb, line 16533 def comment_targets [] #: Array[Prism::node | Location] end
compact_child_nodes() 点击切换源代码
def compact_child_nodes
: () -> Array
# File prism/node.rb, line 16528 def compact_child_nodes [] end
copy(node_id: self.node_id, location: self.location, flags: self.flags, filepath: self.filepath) 点击切换源代码
def copy: (?node_id: Integer, ?location: Location
, ?flags: Integer, ?filepath: String) -> SourceFileNode
# File prism/node.rb, line 16538 def copy(node_id: self.node_id, location: self.location, flags: self.flags, filepath: self.filepath) SourceFileNode.new(source, node_id, location, flags, filepath) end
deconstruct_keys(keys) 点击切换源代码
def deconstruct_keys
: (Array keys) -> { node_id: Integer, location: Location
, filepath: String }
# File prism/node.rb, line 16546 def deconstruct_keys(keys) { node_id: node_id, location: location, filepath: filepath } end
forced_binary_encoding?() 点击切换源代码
def forced_binary_encoding?: () -> bool
# File prism/node.rb, line 16556 def forced_binary_encoding? flags.anybits?(StringFlags::FORCED_BINARY_ENCODING) end
forced_utf8_encoding?() 点击切换源代码
def forced_utf8_encoding?: () -> bool
# File prism/node.rb, line 16551 def forced_utf8_encoding? flags.anybits?(StringFlags::FORCED_UTF8_ENCODING) end
frozen?() 点击切换源代码
def frozen?: () -> bool
# File prism/node.rb, line 16561 def frozen? flags.anybits?(StringFlags::FROZEN) end
inspect() 点击切换源代码
def inspect -> String
# File prism/node.rb, line 16574 def inspect InspectVisitor.compose(self) end
mutable?() 点击切换源代码
def mutable?: () -> bool
# File prism/node.rb, line 16566 def mutable? flags.anybits?(StringFlags::MUTABLE) end
type() 点击切换源代码
返回此节点类型的符号表示。请参见 ‘Node#type’。
# File prism/node.rb, line 16579 def type :source_file_node end