class Bpl::EntrypointLocalization

Constants

DEFAULT_ENTRYPOINT_ANNOTATION

Public Instance Methods

default_entrypoint?(name) click to toggle source
# File lib/bpl/passes/analysis/entrypoint_localization.rb, line 14
def default_entrypoint? name
  name =~ /\bmain\b/i
end
run!(program) click to toggle source
# File lib/bpl/passes/analysis/entrypoint_localization.rb, line 18
def run! program
  program.declarations.each do |d|
    entrypoints << d if d.has_attribute?(attribute)
  end

  program.declarations.each do |d|
    next unless d.is_a?(ProcedureDeclaration)
    entrypoints << d if default_entrypoint?(d.name)
  end if entrypoints.empty?

  warn "No entrypoints found." if entrypoints.empty?
  warn "Found call to entrypoint." if program.any? do |elem|
    elem.is_a?(CallStatement) && entrypoints.include?(elem.target)
  end
end