Skip to content

Remove usage of CommaExp from dmd#5805

Merged
yebblies merged 2 commits intodlang:masterfrom
mathias-lang-sociomantic:remove-commaexp-from-dmd
May 27, 2016
Merged

Remove usage of CommaExp from dmd#5805
yebblies merged 2 commits intodlang:masterfrom
mathias-lang-sociomantic:remove-commaexp-from-dmd

Conversation

@mathias-lang-sociomantic
Copy link
Contributor

Split from #5737

src/dtemplate.d Outdated
size_t j = (t2 && t2.ty == Tident && i == tp.tempinst.tiargs.dim - 1)
? templateParameterLookup(t2, parameters) : IDX_NOTFOUND;
if (j != IDX_NOTFOUND && j == parameters.dim - 1
&& (*parameters)[j].isTemplateTupleParameter())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DMD style puts && on the right.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO that's much less readable, but if it's the existing style...
Now also seems a good time to reiterate the need of a CONTRIBUTING.md file :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a PR somewhere about auto-formatting the source, we'll get there one day.

@mathias-lang-sociomantic
Copy link
Contributor Author

Updated:

diff --git a/src/dtemplate.d b/src/dtemplate.d
index 45be215..e262dae 100644
--- a/src/dtemplate.d
+++ b/src/dtemplate.d
@@ -3786,8 +3786,8 @@ extern (C++) MATCH deduceType(RootObject o, Scope* sc, Type tparam, TemplatePara

                     size_t j = (t2 && t2.ty == Tident && i == tp.tempinst.tiargs.dim - 1)
                         ? templateParameterLookup(t2, parameters) : IDX_NOTFOUND;
-                    if (j != IDX_NOTFOUND && j == parameters.dim - 1
-                        && (*parameters)[j].isTemplateTupleParameter())
+                    if (j != IDX_NOTFOUND && j == parameters.dim - 1 &&
+                        (*parameters)[j].isTemplateTupleParameter())
                     {
                         /* Given:
                          *  struct A(B...) {}
diff --git a/src/expression.d b/src/expression.d
index 2e195d6..63a0b9a 100644
--- a/src/expression.d
+++ b/src/expression.d
@@ -12796,10 +12796,10 @@ public:
                         e2y = (cast(CommaExp)e2y).e2;

                     CallExp ce = (e2y.op == TOKcall) ? cast(CallExp)e2y : null;
-                    DotVarExp dve = (ce !is null && ce.e1.op == TOKdotvar)
+                    DotVarExp dve = (ce && ce.e1.op == TOKdotvar)
                         ? cast(DotVarExp)ce.e1 : null;
-                    if (sd.ctor && ce && dve && dve.var.isCtorDeclaration()
-                        && e2y.type.implicitConvTo(t1))
+                    if (sd.ctor && ce && dve && dve.var.isCtorDeclaration() &&
+                        e2y.type.implicitConvTo(t1))
                     {
                         /* Look for form of constructor call which is:
                          *    __ctmp.ctor(arguments...)
diff --git a/src/func.d b/src/func.d
index cfa45fe..ba4836f 100644
--- a/src/func.d
+++ b/src/func.d
@@ -1275,9 +1275,9 @@ public:
          * the function body.
          */
         TemplateInstance ti;
-        if (fbody
-            && (isFuncLiteralDeclaration() || (storage_class & STCinference) || (inferRetType && !isCtorDeclaration()) || isInstantiated() && !isVirtualMethod()
-                && ((ti = parent.isTemplateInstance()) is null || ti.isTemplateMixin() || ti.tempdecl.ident == ident)))
+        if (fbody &&
+            (isFuncLiteralDeclaration() || (storage_class & STCinference) || (inferRetType && !isCtorDeclaration()) || isInstantiated() && !isVirtualMethod() &&
+             ((ti = parent.isTemplateInstance()) is null || ti.isTemplateMixin() || ti.tempdecl.ident == ident)))
         {
             if (f.purity == PUREimpure) // purity not specified
                 flags |= FUNCFLAGpurityInprocess;

@mathias-lang-sociomantic
Copy link
Contributor Author

Anything else I need to do on my end ?

@yebblies
Copy link
Contributor

Auto-merge toggled on

@yebblies yebblies merged commit a7feab0 into dlang:master May 27, 2016
@mathias-lang-sociomantic mathias-lang-sociomantic deleted the remove-commaexp-from-dmd branch May 27, 2016 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants