Sfoglia il codice sorgente

fix: Support explicit calls to overloaded operators

Closes #252.
pull/329/head
Antonin Delpeuch 10 mesi fa
committed by John Drouhard
parent
commit
3efdaf1c87
2 ha cambiato i file con 36 aggiunte e 0 eliminazioni
  1. +2
    -0
      grammar.js
  2. +34
    -0
      test/corpus/statements.txt

+ 2
- 0
grammar.js Vedi File

@ -96,6 +96,7 @@ module.exports = grammar(C, {
[$.expression_statement, $._for_statement_body],
[$.init_statement, $._for_statement_body],
[$.field_expression, $.template_method, $.template_type],
[$.field_expression, $.template_method],
[$.qualified_field_identifier, $.template_method, $.template_type],
],
@ -1083,6 +1084,7 @@ module.exports = grammar(C, {
$.destructor_name,
$.template_method,
alias($.dependent_field_identifier, $.dependent_name),
$.operator_name,
)),
),

+ 34
- 0
test/corpus/statements.txt Vedi File

@ -618,3 +618,37 @@ void foo(int a) {
(case_statement
(co_yield_statement
(identifier))))))))
================================================================================
Explicit calls to overloaded operators
================================================================================
void foo() {
obj.operator->("arg");
obj.operator==(4);
}
--------------------------------------------------------------------------------
(translation_unit
(function_definition
(primitive_type)
(function_declarator
(identifier)
(parameter_list))
(compound_statement
(expression_statement
(call_expression
(field_expression
(identifier)
(operator_name))
(argument_list
(string_literal
(string_content)))))
(expression_statement
(call_expression
(field_expression
(identifier)
(operator_name))
(argument_list
(number_literal)))))))

Caricamento…
Annulla
Salva