Sha256: 38dd5973dbe9f198414348e9e72065efce09e5fbb2176aedce426a723277b361
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
# encoding: utf-8 # frozen_string_literal: true module Carbon module Compiler module Visitor class Preparation module Struct Preparation.on Node::Definition::Struct => :visit_struct def visit_struct(node) error_multiple_data(node) if @_data @_data = node names = {} node.attributes!([directives_pop]).map! { |c| accept(c, names) } end Preparation.on Node::Definition::Struct::Element => :visit_struct_element def visit_struct_element(node, names) name = node.name.value error_struct_duplicate(node, name, names) if names.key?(name) names[name] = node type = accept(node.type) node.merge(type: type) end private def error_struct_duplicate(node, name, names) @file.emit("Struct/Definition/Duplicate", node.location, [name]) @file.emit("Trace/Location", names[name].location) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
carbon-compiler-0.2.0 | lib/carbon/compiler/visitor/preparation/struct.rb |