Class: AdLint::Ld::ObjectXRefGraphBuilder
- Inherits:
-
Object
- Object
- AdLint::Ld::ObjectXRefGraphBuilder
- Defined in:
- lib/adlint/ld/object.rb
Instance Attribute Summary collapse
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
Instance Method Summary collapse
- #execute(met_fpath) ⇒ Object
-
#initialize(var_map, fun_map, funcall_graph) ⇒ ObjectXRefGraphBuilder
constructor
A new instance of ObjectXRefGraphBuilder.
Constructor Details
#initialize(var_map, fun_map, funcall_graph) ⇒ ObjectXRefGraphBuilder
Returns a new instance of ObjectXRefGraphBuilder.
485 486 487 488 |
# File 'lib/adlint/ld/object.rb', line 485 def initialize(var_map, fun_map, funcall_graph) @var_map, @fun_map = var_map, fun_map @graph = ObjectXRefGraph.new(funcall_graph) end |
Instance Attribute Details
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
490 491 492 |
# File 'lib/adlint/ld/object.rb', line 490 def graph @graph end |
Instance Method Details
#execute(met_fpath) ⇒ Object
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 |
# File 'lib/adlint/ld/object.rb', line 492 def execute(met_fpath) sma_wd = Pathname.pwd CSV.foreach(met_fpath) do |csv_row| if rec = MetricRecord.of(csv_row, sma_wd) case when rec.version? sma_wd = Pathname.new(rec.exec_working_directory) when rec.variable_xref? if var = @var_map.lookup_variables(rec.accessee_variable).first fun_id = rec.accessor_function if fun_id.named? fun = @fun_map.lookup_functions(fun_id.name).first ref = ObjectReferrer.of_function(fun) else ref = ObjectReferrer.of_ctors_section(rec.location) end @graph.add(ObjectReference.new(ref, var, rec.location)) end when rec.function_xref? ref, fun = lookup_referrer_and_function_by_xref(rec) if ref && fun @graph.add(ObjectReference.new(ref, fun, rec.location)) end end end end end |