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.
7639 7640 7641 7642 7643 |
# File 'lib/adlint/cc1/type.rb', line 7639 def initialize(type_tbl, interp, type) @type_table = type_tbl @interpreter = interp @type = type end |
Instance Method Details
#visit_abbreviated_function_declarator(node) ⇒ Object
7687 7688 7689 7690 7691 |
# File 'lib/adlint/cc1/type.rb', line 7687 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
7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 |
# File 'lib/adlint/cc1/type.rb', line 7668 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
7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 |
# File 'lib/adlint/cc1/type.rb', line 7704 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
7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 |
# File 'lib/adlint/cc1/type.rb', line 7654 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
7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 |
# File 'lib/adlint/cc1/type.rb', line 7719 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
7699 7700 7701 7702 |
# File 'lib/adlint/cc1/type.rb', line 7699 def visit_grouped_abstract_declarator(node) @type = qualify_by_pointer(@type, node) @type = node.base.accept(self) end |
#visit_grouped_declarator(node) ⇒ Object
7649 7650 7651 7652 |
# File 'lib/adlint/cc1/type.rb', line 7649 def visit_grouped_declarator(node) @type = qualify_by_pointer(@type, node) @type = node.base.accept(self) end |
#visit_identifier_declarator(node) ⇒ Object
7645 7646 7647 |
# File 'lib/adlint/cc1/type.rb', line 7645 def visit_identifier_declarator(node) @type = qualify_by_pointer(@type, node) end |
#visit_kandr_function_declarator(node) ⇒ Object
7681 7682 7683 7684 7685 |
# File 'lib/adlint/cc1/type.rb', line 7681 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
7693 7694 7695 7696 7697 |
# File 'lib/adlint/cc1/type.rb', line 7693 def visit_pointer_abstract_declarator(node) @type = qualify_by_pointer(@type, node) @type = node.base.accept(self) if node.base @type end |