class AdLint::Exam::CBuiltin::FN_GOTO
Public Class Methods
new(phase_ctxt)
click to toggle source
Calls superclass method
AdLint::Examination::new
# File lib/adlint/exam/c_builtin/cc1_metric.rb, line 392 def initialize(phase_ctxt) super @fpath = phase_ctxt[:sources].first.fpath trav = phase_ctxt[:cc1_ast_traversal] trav.enter_ansi_function_definition += T(:enter_function) trav.leave_ansi_function_definition += T(:leave_function) trav.enter_kandr_function_definition += T(:enter_function) trav.leave_kandr_function_definition += T(:leave_function) trav.enter_goto_statement += T(:count_goto) @cur_fun = nil @goto_cnt = 0 end
Private Instance Methods
count_goto(*)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_metric.rb, line 424 def count_goto(*) if @cur_fun @goto_cnt += 1 end end
do_execute(*)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_metric.rb, line 407 def do_execute(*) end
do_prepare(*)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_metric.rb, line 406 def do_prepare(*) end
enter_function(fun_def)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_metric.rb, line 409 def enter_function(fun_def) @cur_fun = fun_def @goto_cnt = 0 end
leave_function(*)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_metric.rb, line 414 def leave_function(*) if @cur_fun FN_GOTO(FunctionId.new(@cur_fun.identifier.value, @cur_fun.signature.to_s), @cur_fun.location, @goto_cnt) @cur_fun = nil @goto_cnt = 0 end end