Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added parse-only support for pure virtual methods #469

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,13 @@ class_items /* IEEE1800-2005: A.1.2 */
| class_item
;

pure_virtual_method_decl /* IEEE1800-2012: A.1.9 */
: K_pure K_virtual K_task IDENTIFIER ';'
| K_pure K_virtual K_task IDENTIFIER '(' tf_port_list_opt ')' ';'
| K_pure K_virtual K_function data_type_or_implicit_or_void IDENTIFIER ';'
| K_pure K_virtual K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' ';'
;

class_item /* IEEE1800-2005: A.1.8 */

/* IEEE1800 A.1.8: class_constructor_declaration */
Expand Down Expand Up @@ -907,6 +914,11 @@ class_item /* IEEE1800-2005: A.1.8 */
| method_qualifier_opt function_declaration
{ /* The function_declaration rule puts this into the class */ }

| pure_virtual_method_decl
{ yywarn(@1, "OOP Pure Virtual methods are supported as parse-only. "
"No enforcement is done for a concrete class to define these further");
}

Comment on lines +917 to +921
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We really need a "Sorry" message here, and not a warning. Since the feature is supported, it should generate an error, and a "Sorry" message (see examples elsewhere in the code) is the convention for expressing that.

/* External class method definitions... */

| K_extern method_qualifier_opt K_function K_new ';'
Expand Down Expand Up @@ -1811,7 +1823,7 @@ loop_variables /* IEEE1800-2005: A.6.8 */
}
;

method_qualifier /* IEEE1800-2005: A.1.8 */
method_qualifier /* IEEE1800-2012: A.1.9 */
: K_virtual
| class_item_qualifier
;
Expand Down