Skip to content

Remove legacy enum structs.#373

Merged
dvander merged 1 commit intomasterfrom
rm-es
Sep 17, 2019
Merged

Remove legacy enum structs.#373
dvander merged 1 commit intomasterfrom
rm-es

Conversation

@dvander
Copy link
Member

@dvander dvander commented Sep 16, 2019

This patch effectively cuts enum structs off at the knees. The root constant
created by an enum is now defined as 0, and it's illegal to create
arrays using this constant. Parsing support has been removed from the
index operator, and the index operator (and old-array decl syntax) now
require types implicitly convertible to integers.

In addition, support for tagging items in enums has been removed, as
there is no longer a need for this behavior.

The underlying mechanism for this mess is still supported, however,
because it is used for transitional enum structs. This patch simply
removes the worst hacks in the parser and hier1().

Plugins using the old array-as-struct syntax will no longer compile, and
should use the new enum struct syntax instead.

Bug: N/A
Test: manual test

@psychonic
Copy link
Member

⚰️

{
Type* idx_type = gTypes.find(tag);
if (idx_type->isStruct() || idx_type->isFunction() || idx_type->isEnumStruct() ||
idx_type->isMethodmap() || tag == pc_tag_void || tag == sc_rationaltag)
Copy link
Contributor

Choose a reason for hiding this comment

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

pc_tag_string? I dunno if there's a better way than listing these all out.

Copy link
Member Author

Choose a reason for hiding this comment

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

I couldn't decide if pc_tag_string should be included, indexing by char sounds like a legit thing.

@Fyren
Copy link
Contributor

Fyren commented Sep 16, 2019

Tests that trigger the new errors would be nice.

@dvander
Copy link
Member Author

dvander commented Sep 16, 2019

Added tests.

@dvander
Copy link
Member Author

dvander commented Sep 16, 2019

Improved error message.

This patch effectively cuts enum structs off at the knees. The root constant
created by an enum is now defined as 0, and it's illegal to create
arrays using this constant. Parsing support has been removed from the
index operator, and the index operator (and old-array decl syntax) now
require types implicitly convertible to integers.

In addition, support for tagging items in enums has been removed, as
there is no longer a need for this behavior.

The underlying mechanism for this mess is still supported, however,
because it is used for transitional enum structs. This patch simply
removes the worst hacks in the parser and hier1().

Plugins using the old array-as-struct syntax will no longer compile, and
should use the new enum struct syntax instead.

Bug: N/A
Test: new tests
@dvander dvander merged commit 4a70cfc into master Sep 17, 2019
@dvander dvander deleted the rm-es branch September 17, 2019 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants