executeは他のSingleModuleAnalyzerクラスのメソッド同様、analyzer.rbにある。
まずLanguage#ofを呼んで、言語を設定している。ここで言っているのは日本語とか英語とかのことではなく、CとC++の切り替えだ。Languageクラスはlang.rb内にあり、ofは現状ハードコードでCを指定している。まぁC++のパースとか大変だもんな……
実際に返しているのは以下のようなもの。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class C | |
include AdLint::C::ScannerConstants | |
extend AdLint::C::Scanner | |
class << self | |
def single_module_phases | |
[ | |
AdLint::Cpp::PreparePhase, | |
# Snip... | |
].freeze | |
end | |
def check_phases | |
[ | |
AdLint::Cpp::PreparePhase, | |
# Snip... | |
].freeze | |
end | |
end | |
end |
続けてProgressMonitorのインスタンスを用意しReport#newにブロックを渡して内部で処理をやっている。PhaseContextのインスタンスを作り、ソースのパスとシンボルテーブルを用意してから、Langから取得したモジュール群を、次のようなコードで順にexecuteしていっている。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
lang.single_module_phases.each do |phase_class| | |
phase_class.new(context).execute | |
end | |
ensure | |
# snip... | |
end |
なかなか実際の中身に入れんなー。
0 件のコメント:
コメントを投稿