-
-
Notifications
You must be signed in to change notification settings - Fork 651
extract mangleExpression() from Mangler #14471
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
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request, @WalterBright! 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#14471" |
37ba775
to
444cf44
Compare
The buildkite issues appear to be heisenbugs. |
444cf44
to
d50d5f8
Compare
@RazvanN7 Ready to go. |
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 understand why the interface was changed to receive Backref
instead of a type. It is much more elegant to instantiate the Backref at the callee site rather than uselessly sending a reference from the called.
this.buf = buf; | ||
this.backref = Backref(rootType); | ||
} | ||
|
||
void mangleSymbol(Dsymbol s) |
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 and the following functions should be indented properly.
assert(0); | ||
} | ||
|
||
} |
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.
Please mind the indentation.
if (t.deco) | ||
buf.writestring(t.deco); | ||
else | ||
{ | ||
scope Mangler v = new Mangler(buf, t); | ||
v.visitWithMask(t, 0); | ||
auto backref = Backref(t); |
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.
Why is this kept outisde of the mangleType
function? It doesn't really make any sense to put this burden on the caller. Just have mangleType
receive a type as the class constructor did and instantiate the backref there.
|
||
/************************************************************* | ||
*/ | ||
void mangleFuncType(TypeFunction t, TypeFunction ta, ubyte modMask, Type tret, OutBuffer* buf, ref Backref backref) |
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 should be private.
|
||
/************************************************************* | ||
*/ | ||
void mangleParameter(Parameter p, OutBuffer* buf, ref Backref backref) |
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 should be private.
if (!fd.mangleString) | ||
{ | ||
OutBuffer buf; | ||
scope Mangler v = new Mangler(&buf); | ||
auto backref = Backref(null); |
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.
Why is this outside of the Mangler
constructor?
* buf = buffer to append mangling to | ||
* backref = state of back references (updated) | ||
*/ | ||
void mangleType(Type t, ubyte modMask, OutBuffer* buf, ref Backref backref) |
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 should be private.
@WalterBright Please address Razvan's review |
case Tvoid: | ||
case Tint8: | ||
case Tuns8: | ||
case Tint16: | ||
case Tuns16: | ||
case Tint32: | ||
case Tuns32: | ||
case Tint64: | ||
|
||
case Tuns64: | ||
case Tfloat32: | ||
case Tfloat64: | ||
case Tfloat80: | ||
case Timaginary32: | ||
case Timaginary64: | ||
case Timaginary80: | ||
case Tcomplex32: | ||
case Tcomplex64: | ||
case Tcomplex80: | ||
|
||
case Tbool: | ||
case Tchar: | ||
case Twchar: | ||
case Tdchar: | ||
|
||
case Tint128: | ||
case Tuns128: visitType(t); break; | ||
|
||
case Tpointer: | ||
case Treference: | ||
case Tdelegate: | ||
case Tslice: visitTypeNext (cast(TypeNext)t); break; | ||
|
||
case Tarray: visitTypeDArray (t.isTypeDArray()); break; | ||
case Tsarray: visitTypeSArray (t.isTypeSArray()); break; | ||
case Taarray: visitTypeAArray (t.isTypeAArray()); break; | ||
case Tfunction: visitTypeFunction (t.isTypeFunction()); break; | ||
case Tident: visitTypeIdentifier(t.isTypeIdentifier()); break; | ||
case Tclass: visitTypeClass (t.isTypeClass()); break; | ||
case Tstruct: visitTypeStruct (t.isTypeStruct()); break; | ||
case Tenum: visitTypeEnum (t.isTypeEnum()); break; | ||
case Ttuple: visitTypeTuple (t.isTypeTuple()); break; | ||
case Tnull: visitTypeNull (t.isTypeNull()); break; | ||
case Tvector: visitTypeVector (t.isTypeVector()); break; | ||
case Tnoreturn: visitTypeNoreturn (t.isTypeNoreturn); break; | ||
|
||
case Terror: | ||
break; // ignore errors | ||
|
||
default: | ||
assert(0); |
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 was already reverted because it caused a regression.
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.
It would help if you said what the regression was.
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 did in the introducing pr
#14468 (comment)
ping @WalterBright |
@WalterBright are you still working on this? |
Use nested functions instead of visitor.