-
-
Notifications
You must be signed in to change notification settings - Fork 607
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
Extract include
func to dsymbolsem
#16970
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request and interest in making D better, @dchidindu5! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#16970" |
private bool addisdone = false; /// true if members have been added to scope | ||
private bool onStack = false; /// true if a call to `include` is currently active | ||
public bool addisdone = false; /// true if members have been added to scope | ||
public bool onStack = false; /// true if a call to `include` is currently active |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also be sure to update attrib.h
and frontend.h
to reflect the changes made
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd do that once I'm done with the refactoring
{ | ||
alias visit = typeof(super).visit; | ||
Scope* sc; | ||
Dsymbols* symbols; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's with this declaration? This shouldn't be here. AttribDeclaration defines the include
method and all the children of AttribDeclaration override this method hence they have access to the array of declarations. I assume you actually wanted to have access to the decl
field of AttribDeclaration? If you, you need to add a visitation method for AttribDeclaration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't totally understand this please
can it be casted? what about |
{ | ||
assert(!sfd.onStack); | ||
symbols= sfd.cache; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is equivalent to:
if (sfd.errors || sfd.onStack)
{
if (sfd.cached)
{
assert(!sfd.onStack);
symbols= sfd.cache;
}
}
Whereas what you want is:
if (sfd.errors || sfd.onStack)
{
symbols = null;
return;
}
if (sfd.cached)
{
assert(!sfd.onStack);
symbols= sfd.cache;
return;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also symbols = sfd.cache;
with proper spaces.
What's the appropriate way to cast this |
this(Scope* sc) | ||
{ | ||
this.sc = sc; | ||
this.symbols = symbols; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assignment doesn't make any sense. Delete it.
} | ||
assert(cdc.condition); | ||
symbols = cdc.condition.include(cdc._scope ? cdc._scope : sc) ? cdc.decl : cdc.elsedecl; | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This return
is unnecessary.
sfd.cached = true; | ||
sfd.cache = d; | ||
symbols = d; | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This return is not necessary.
This variables were private before I had to change it to public because I encountered errors like
undefined identifier
onStack and addisdone`Still working on them though