-
Notifications
You must be signed in to change notification settings - Fork 211
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
SP004: implement initialize list translation to ctor #5215
Draft
kaizhangNV
wants to merge
13
commits into
shader-slang:master
Choose a base branch
from
kaizhangNV:feature/initialize-list
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
SP004: implement initialize list translation to ctor #5215
kaizhangNV
wants to merge
13
commits into
shader-slang:master
from
kaizhangNV:feature/initialize-list
Commits on Oct 10, 2024
-
SP004: implement initialize list translation to ctor
This is the first change to implement part of SP004, what this change does: 1. We synthesize a member-wise constructor for each struct follow the rules described in SP004. 2. Add logic to translate the initialize list to constructor invoke TODO: what needs to be done next 1. We didn't fill the body of the synthesized constructor - This is relative easy task. 2. The fall back to legacy initialize list logic is not done - I found out that it's straight forward to put this logic after ResolveInvoke() call, because after ResolveInvoke() we will need to do a final 'coerce()' check to determine whether the candidate is applicable to use. If that fails, we can do the C-Style struct check and fall back to legacy logic. 3. Should we enable this for stdlib as well? - Our stdlib has some syntax that external users cannot use, so whether this change could break anything is unknown for now. It needs some extra effort to investigate and debugging the potential compile issue.
Configuration menu - View commit details
-
Copy full SHA for daa1fe0 - Browse repository at this point
Copy the full SHA daa1fe0View commit details -
simplify the logic for creating invoke for synthesized ctor
Separate the logic of _invokeExprForSynthesizedCtor from _readAggregateValueFromInitializerList. Because we don't really need to read and coerce the values recursively from the initializer list when we go this path. After we form a invoke expression to synthesized ctor, the ResolveInvoke logic will help us to coerce the arguments.
Configuration menu - View commit details
-
Copy full SHA for 23a2f4a - Browse repository at this point
Copy the full SHA 23a2f4aView commit details -
Implement a fallback mechanism to the legacy init list
After we create the constructor invoke expression, we need to resolve this expression by ResolveInvoke(), and if it's failed we need a mechanism to fallback to the legacy initialization list logic. This change use sub visitor with a temporary diagnose sink to call the ResolveInvoke(), such that compile process won't be aborted if the error happens. The condition allowing the fall back is that the struct has to be a C-style struct, described in: https://github.com/shader-slang/slang/blob/master/docs/proposals/004-initialization.md
Configuration menu - View commit details
-
Copy full SHA for 122d70e - Browse repository at this point
Copy the full SHA 122d70eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 59c96f0 - Browse repository at this point
Copy the full SHA 59c96f0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 863de5c - Browse repository at this point
Copy the full SHA 863de5cView commit details -
Apply the new rule for inheritance
When searching the menbers of base type, we don't pick the fields of base type, instead, we will pick from parameter list of base type's constructor.
Configuration menu - View commit details
-
Copy full SHA for f1eb290 - Browse repository at this point
Copy the full SHA f1eb290View commit details -
Configuration menu - View commit details
-
Copy full SHA for 05dcbbf - Browse repository at this point
Copy the full SHA 05dcbbfView commit details -
Don't report error when checking synthesized constructor, we will remove this constructor instead. Change the location where we create the member initialize constructor signature to SemanticsDeclAttributesVisitor to avoid the circular checking problem.
Configuration menu - View commit details
-
Copy full SHA for 3a3b055 - Browse repository at this point
Copy the full SHA 3a3b055View commit details -
1. When extension of a struct defines __init, we should not synthesize __init anymore. 2. For the synthesized __init signature, we correct the default value for the parameter. Figuring out what exactly is "default initialize type". If a type has a ctor can take 0 parameter, it's default initialize type.
Configuration menu - View commit details
-
Copy full SHA for 4ed14e9 - Browse repository at this point
Copy the full SHA 4ed14e9View commit details -
Struct Inheriting from a interface doesn't violate the rules of C-Style struct. Add the visibility modifier to the synthesized ctor.
Configuration menu - View commit details
-
Copy full SHA for 1013d73 - Browse repository at this point
Copy the full SHA 1013d73View commit details -
Configuration menu - View commit details
-
Copy full SHA for 406bc53 - Browse repository at this point
Copy the full SHA 406bc53View commit details -
Configuration menu - View commit details
-
Copy full SHA for f9b905e - Browse repository at this point
Copy the full SHA f9b905eView commit details
Commits on Oct 13, 2024
-
We need to ensure the definite checked for a struct before trying to use its constructor in the initialize list coerce.
Configuration menu - View commit details
-
Copy full SHA for a548615 - Browse repository at this point
Copy the full SHA a548615View commit details
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.