Class: AdLint::Cc1::DeclaratorInterpreter
- Inherits:
-
Object
- Object
- AdLint::Cc1::DeclaratorInterpreter
- Defined in:
- lib/adlint/cc1/type.rb
Instance Method Summary collapse
-
#initialize(type_tbl, interp, type) ⇒ DeclaratorInterpreter
constructor
A new instance of DeclaratorInterpreter.
- #visit_abbreviated_function_declarator(node) ⇒ Object
- #visit_ansi_function_declarator(node) ⇒ Object
- #visit_array_abstract_declarator(node) ⇒ Object
- #visit_array_declarator(node) ⇒ Object
- #visit_function_abstract_declarator(node) ⇒ Object
- #visit_grouped_abstract_declarator(node) ⇒ Object
- #visit_grouped_declarator(node) ⇒ Object
- #visit_identifier_declarator(node) ⇒ Object
- #visit_kandr_function_declarator(node) ⇒ Object
- #visit_pointer_abstract_declarator(node) ⇒ Object
Constructor Details
#initialize(type_tbl, interp, type) ⇒ DeclaratorInterpreter
Returns a new instance of DeclaratorInterpreter.
7627 7628 7629 7630 7631 |
# File 'lib/adlint/cc1/type.rb', line 7627 def initialize(type_tbl, interp, type) @type_table = type_tbl @interpreter = interp @type = type end |
Instance Method Details
#visit_abbreviated_function_declarator(node) ⇒ Object
7675 7676 7677 7678 7679 |
# File 'lib/adlint/cc1/type.rb', line 7675 def visit_abbreviated_function_declarator(node) @type = qualify_by_pointer(@type, node) @type = @type_table.function_type(@type, []) @type = node.base.accept(self) end |
#visit_ansi_function_declarator(node) ⇒ Object
7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 |
# File 'lib/adlint/cc1/type.rb', line 7656 def visit_ansi_function_declarator(node) @type = qualify_by_pointer(@type, node) param_types = lookup_parameter_types(node) if param_types.include?(nil) return @type_table.unresolved_type else have_va_list = node.parameter_type_list.have_va_list? @type = @type_table.function_type(@type, param_types, have_va_list) @type = node.base.accept(self) end @type end |
#visit_array_abstract_declarator(node) ⇒ Object
7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 |
# File 'lib/adlint/cc1/type.rb', line 7692 def visit_array_abstract_declarator(node) @type = qualify_by_pointer(@type, node) if size_expr = node.size_expression if ary_size = evaluate_size_expression(size_expr) @type = @type_table.array_type(@type, ary_size) else return @type_table.unresolved_type end else @type = @type_table.array_type(@type) end @type = node.base.accept(self) if node.base @type end |
#visit_array_declarator(node) ⇒ Object
7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 |
# File 'lib/adlint/cc1/type.rb', line 7642 def visit_array_declarator(node) @type = qualify_by_pointer(@type, node) if size_expr = node.size_expression if ary_size = evaluate_size_expression(size_expr) @type = @type_table.array_type(@type, ary_size) else return @type_table.unresolved_type end else @type = @type_table.array_type(@type) end @type = node.base.accept(self) end |
#visit_function_abstract_declarator(node) ⇒ Object
7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 |
# File 'lib/adlint/cc1/type.rb', line 7707 def visit_function_abstract_declarator(node) @type = qualify_by_pointer(@type, node) param_types = lookup_parameter_types(node) if param_types.include?(nil) return @type_table.unresolved_type else @type = @type_table.function_type(@type, param_types) @type = node.base.accept(self) if node.base end @type end |
#visit_grouped_abstract_declarator(node) ⇒ Object
7687 7688 7689 7690 |
# File 'lib/adlint/cc1/type.rb', line 7687 def visit_grouped_abstract_declarator(node) @type = qualify_by_pointer(@type, node) @type = node.base.accept(self) end |
#visit_grouped_declarator(node) ⇒ Object
7637 7638 7639 7640 |
# File 'lib/adlint/cc1/type.rb', line 7637 def visit_grouped_declarator(node) @type = qualify_by_pointer(@type, node) @type = node.base.accept(self) end |
#visit_identifier_declarator(node) ⇒ Object
7633 7634 7635 |
# File 'lib/adlint/cc1/type.rb', line 7633 def visit_identifier_declarator(node) @type = qualify_by_pointer(@type, node) end |
#visit_kandr_function_declarator(node) ⇒ Object
7669 7670 7671 7672 7673 |
# File 'lib/adlint/cc1/type.rb', line 7669 def visit_kandr_function_declarator(node) @type = qualify_by_pointer(@type, node) @type = @type_table.function_type(@type, []) @type = node.base.accept(self) end |
#visit_pointer_abstract_declarator(node) ⇒ Object
7681 7682 7683 7684 7685 |
# File 'lib/adlint/cc1/type.rb', line 7681 def visit_pointer_abstract_declarator(node) @type = qualify_by_pointer(@type, node) @type = node.base.accept(self) if node.base @type end |