-
-
Notifications
You must be signed in to change notification settings - Fork 675
Translate _d_newclass to a template
#14837
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1544,7 +1544,8 @@ extern (C++) abstract class Expression : ASTNode | |
| // Lowered non-@nogc'd hooks will print their own error message inside of nogc.d (NOGCVisitor.visit(CallExp e)), | ||
| // so don't print anything to avoid double error messages. | ||
| if (!(f.ident == Id._d_HookTraceImpl || f.ident == Id._d_arraysetlengthT | ||
| || f.ident == Id._d_arrayappendT || f.ident == Id._d_arrayappendcTX)) | ||
| || f.ident == Id._d_arrayappendT || f.ident == Id._d_arrayappendcTX | ||
| || f.ident == Id._d_newclassT)) | ||
| error("`@nogc` %s `%s` cannot call non-@nogc %s `%s`", | ||
| sc.func.kind(), sc.func.toPrettyChars(), f.kind(), f.toPrettyChars()); | ||
|
|
||
|
|
@@ -3650,6 +3651,8 @@ extern (C++) final class NewExp : Expression | |
| bool onstack; // allocate on stack | ||
| bool thrownew; // this NewExp is the expression of a ThrowStatement | ||
|
|
||
| Expression lowering; // lowered druntime hook: `_d_newclass` | ||
teodutu marked this conversation as resolved.
Show resolved
Hide resolved
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this necessary? If yes keep it but keep an eye on adding unnecessary fields as dmd's classes are absolutely enormous
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's necessary. I need an expression where to store the lowering, so I can then pass it to the backend in e2ir.d. This expression can either be a field in |
||
|
|
||
| extern (D) this(const ref Loc loc, Expression thisexp, Type newtype, Expressions* arguments) | ||
| { | ||
| super(loc, EXP.new_, __traits(classInstanceSize, NewExp)); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -539,6 +539,8 @@ class NewExp final : public Expression | |
| bool onstack; // allocate on stack | ||
| bool thrownew; // this NewExp is the expression of a ThrowStatement | ||
|
|
||
| Expression lowering; // lowered druntime hook: `_d_newclass` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't have this been a pointer?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Fixed by #14872. |
||
|
|
||
| static NewExp *create(const Loc &loc, Expression *thisexp, Type *newtype, Expressions *arguments); | ||
| NewExp *syntaxCopy() override; | ||
|
|
||
|
|
||
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.
Are previous lowerings going to be retroactively transplanted into a lowering field?
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.
Yes, that's the plan.