Class: AdLint::Cpp::Macro

Inherits:
Object
  • Object
show all
Includes:
LocationHolder
Defined in:
lib/adlint/cpp/macro.rb

Direct Known Subclasses

FunctionLikeMacro, ObjectLikeMacro

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from LocationHolder

#analysis_target?

Constructor Details

#initialize(define_line) ⇒ Macro

Returns a new instance of Macro.



44
45
46
# File 'lib/adlint/cpp/macro.rb', line 44

def initialize(define_line)
  @define_line = define_line
end

Instance Attribute Details

#define_lineObject (readonly)

Returns the value of attribute define_line.



48
49
50
# File 'lib/adlint/cpp/macro.rb', line 48

def define_line
  @define_line
end

Instance Method Details

#expand(toks, macro_tbl, repl_ctxt) ⇒ Object



62
63
64
# File 'lib/adlint/cpp/macro.rb', line 62

def expand(toks, macro_tbl, repl_ctxt)
  @define_line.mark_as_referred_by(toks.first)
end

#function_like?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/adlint/cpp/macro.rb', line 66

def function_like?
  subclass_responsibility
end

#locationObject



58
59
60
# File 'lib/adlint/cpp/macro.rb', line 58

def location
  @define_line.location
end

#nameObject



50
51
52
# File 'lib/adlint/cpp/macro.rb', line 50

def name
  @define_line.identifier
end

#replacement_listObject



54
55
56
# File 'lib/adlint/cpp/macro.rb', line 54

def replacement_list
  @define_line.replacement_list
end