class AdLint::Exam::CBuiltin::FN_STMT
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 114 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_error_statement += T(:count_statement) trav.enter_generic_labeled_statement += T(:count_statement) trav.enter_case_labeled_statement += T(:count_statement) trav.enter_default_labeled_statement += T(:count_statement) trav.enter_expression_statement += T(:count_statement) trav.enter_if_statement += T(:count_statement) trav.enter_if_else_statement += T(:count_statement) trav.enter_switch_statement += T(:count_statement) trav.enter_while_statement += T(:count_statement) trav.enter_do_statement += T(:count_statement) trav.enter_for_statement += T(:count_statement) trav.enter_c99_for_statement += T(:count_statement) trav.enter_goto_statement += T(:count_statement) trav.enter_continue_statement += T(:count_statement) trav.enter_break_statement += T(:count_statement) trav.enter_return_statement += T(:count_statement) @cur_fun = nil @stmt_cnt = 0 end
Private Instance Methods
count_statement(*)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_metric.rb, line 162 def count_statement(*) @stmt_cnt += 1 if @cur_fun end
do_execute(*)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_metric.rb, line 144 def do_execute(*) end
do_prepare(*)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_metric.rb, line 143 def do_prepare(*) end
enter_function(fun_def)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_metric.rb, line 146 def enter_function(fun_def) @cur_fun = fun_def @stmt_cnt = 0 end
leave_function(*)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_metric.rb, line 151 def leave_function(*) if @cur_fun FN_STMT(FunctionId.new(@cur_fun.identifier.value, @cur_fun.signature.to_s), @cur_fun.location, @stmt_cnt) @cur_fun = nil @stmt_cnt = 0 end end