Skip to content

Commit

Permalink
constify some global.gag usages
Browse files Browse the repository at this point in the history
  • Loading branch information
thewilsonator committed Oct 15, 2024
1 parent 48cd22b commit 87cc68b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dmd/declaration.d
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ extern (C++) class VarDeclaration : Declaration
assert(type && _init);

// Ungag errors when not speculative
uint oldgag = global.gag;
const oldgag = global.gag;
if (global.gag)
{
Dsymbol sym = isMember();
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/dsymbol.d
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ extern (C++) class Dsymbol : ASTNode

final Ungag ungagSpeculative() const
{
uint oldgag = global.gag;
const oldgag = global.gag;
if (global.gag && !isSpeculative() && !toParent2().isFuncDeclaration())
global.gag = 0;
return Ungag(oldgag);
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dmd/funcsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ bool functionSemantic(FuncDeclaration fd)
{
TemplateInstance spec = fd.isSpeculative();
const olderrs = global.errors;
uint oldgag = global.gag;
const oldgag = global.gag;
if (global.gag && !spec)
global.gag = 0;
dsymbolSemantic(fd, fd._scope);
Expand Down Expand Up @@ -1224,7 +1224,7 @@ bool functionSemantic3(FuncDeclaration fd)
*/
TemplateInstance spec = fd.isSpeculative();
const olderrs = global.errors;
uint oldgag = global.gag;
const oldgag = global.gag;
if (global.gag && !spec)
global.gag = 0;
semantic3(fd, fd._scope);
Expand Down

0 comments on commit 87cc68b

Please sign in to comment.