Class: AdLint::Cc1::ArrayDeclarator

Inherits:
Declarator show all
Defined in:
lib/adlint/cc1/syntax.rb

Instance Attribute Summary collapse

Attributes inherited from Declarator

#pointer

Attributes inherited from SyntaxNode

#head_token, #subsequent_sequence_point, #tail_token

Instance Method Summary collapse

Methods inherited from Declarator

#abstract?, #full=, #full?, #variable?

Methods inherited from SyntaxNode

#head_location, #short_class_name, #tail_location

Methods included from LocationHolder

#analysis_target?

Methods included from Visitable

#accept

Constructor Details

#initialize(base_dcr, size_expr) ⇒ ArrayDeclarator

Returns a new instance of ArrayDeclarator.



3215
3216
3217
3218
3219
# File 'lib/adlint/cc1/syntax.rb', line 3215

def initialize(base_dcr, size_expr)
  super()
  @base = base_dcr
  @size_expression = size_expr
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



3221
3222
3223
# File 'lib/adlint/cc1/syntax.rb', line 3221

def base
  @base
end

#size_expressionObject (readonly)

Returns the value of attribute size_expression.



3222
3223
3224
# File 'lib/adlint/cc1/syntax.rb', line 3222

def size_expression
  @size_expression
end

Instance Method Details

#function?(stack = []) ⇒ Boolean

Returns:

  • (Boolean)


3244
3245
3246
3247
3248
3249
# File 'lib/adlint/cc1/syntax.rb', line 3244

def function?(stack = [])
  stack.push(:pointer) if pointer
  stack.push(:array)
  @base.function?(stack)
  stack.last == :function
end

#identifierObject



3228
3229
3230
# File 'lib/adlint/cc1/syntax.rb', line 3228

def identifier
  @base.identifier
end

#identifier_listObject



3240
3241
3242
# File 'lib/adlint/cc1/syntax.rb', line 3240

def identifier_list
  @base.identifier_list
end

#innermost_parameter_type_listObject



3236
3237
3238
# File 'lib/adlint/cc1/syntax.rb', line 3236

def innermost_parameter_type_list
  @base.innermost_parameter_type_list
end

#inspect(indent = 0) ⇒ Object



3251
3252
3253
# File 'lib/adlint/cc1/syntax.rb', line 3251

def inspect(indent = 0)
  " " * indent + "#{short_class_name}\n" + @base.inspect(indent + 1)
end

#locationObject



3224
3225
3226
# File 'lib/adlint/cc1/syntax.rb', line 3224

def location
  @base ? @base.location || head_location : head_location
end

#parameter_type_listObject



3232
3233
3234
# File 'lib/adlint/cc1/syntax.rb', line 3232

def parameter_type_list
  @base.parameter_type_list
end