Skip to content

Commit

Permalink
should no longer need the else clause (#17093)
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright authored Nov 25, 2024
1 parent 2a76803 commit a36acce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
13 changes: 2 additions & 11 deletions compiler/src/dmd/expressionsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -2081,17 +2081,8 @@ public void errorSupplementalInferredAttr(FuncDeclaration fd, int maxDepth, bool
errorSupplementalInferredAttr(s.fd, maxDepth - 1, deprecation, stc, eSink);
}
}
else if (auto sa = s.arg0.isDsymbol())
{
if (FuncDeclaration fd2 = sa.isFuncDeclaration())
{
if (maxDepth > 0)
{
errorFunc(s.loc, "which calls `%s`", fd2.toPrettyChars());
errorSupplementalInferredAttr(fd2, maxDepth - 1, deprecation, stc, eSink);
}
}
}
else
assert(0);
}

/*******************************************
Expand Down
18 changes: 11 additions & 7 deletions compiler/src/dmd/func.d
Original file line number Diff line number Diff line change
Expand Up @@ -685,26 +685,30 @@ extern (C++) class FuncDeclaration : Declaration
*
* Params:
* loc = location of action
* fmt = format string for error message
* format = format string for error message
* arg0 = (optional) argument to format string
*/
extern (D) final void setThrow(Loc loc, const(char)* fmt, RootObject arg0 = null)
extern (D) final void setThrow(Loc loc, const(char)* format, RootObject arg0 = null)
{
if (nothrowInprocess && !nothrowViolation)
{
nothrowViolation = new AttributeViolation(loc, fmt, arg0); // action that requires GC
assert(format);
nothrowViolation = new AttributeViolation(loc, format, arg0); // action that requires GC
}
}

/**************************************
* The function calls non-`nothrow` function f, register that in case nothrow is being inferred
* Params:
* loc = location of call
* f = function being called
* fd = function being called
*/
extern (D) final void setThrowCall(Loc loc, FuncDeclaration f)
extern (D) final void setThrowCall(Loc loc, FuncDeclaration fd)
{
return setThrow(loc, null, f);
if (nothrowInprocess && !nothrowViolation)
{
nothrowViolation = new AttributeViolation(loc, fd); // action that requires GC
}
}

/****************************************
Expand Down Expand Up @@ -1886,7 +1890,7 @@ struct AttributeViolation

this(ref Loc loc, const(char)* format, RootObject arg0 = null, RootObject arg1 = null, RootObject arg2 = null)
{
//assert(format);
assert(format);
this.loc = loc;
this.format = format;
this.arg0 = arg0;
Expand Down

0 comments on commit a36acce

Please sign in to comment.