Conversation
Member
|
⚰️ |
Fyren
reviewed
Sep 16, 2019
compiler/expressions.cpp
Outdated
| { | ||
| 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) |
Contributor
There was a problem hiding this comment.
pc_tag_string? I dunno if there's a better way than listing these all out.
Member
Author
There was a problem hiding this comment.
I couldn't decide if pc_tag_string should be included, indexing by char sounds like a legit thing.
Fyren
reviewed
Sep 16, 2019
Contributor
|
Tests that trigger the new errors would be nice. |
Member
Author
|
Added tests. |
Headline
reviewed
Sep 16, 2019
Member
Author
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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