Merge branch 'stable' into master

This commit is contained in:
Dennis Korpel 2024-11-29 12:46:34 +01:00
commit 74c40e9be0
53 changed files with 187 additions and 86 deletions

View file

@ -4176,6 +4176,7 @@ void cdmemset(ref CGstate cg, ref CodeBuilder cdb,elem *e,ref regm_t pretregs)
if (valueIsConst)
{
regwithvalue(cdb, mAX, value, I64?64:0);
getregs(cdb, mAX);
freenode(evalue);
}
else

View file

@ -5650,7 +5650,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
if (exp.fd.ident != Id.empty)
return;
const(char)[] s;
string s;
if (exp.fd.fes)
s = "__foreachbody";
else if (exp.fd.tok == TOK.reserved)
@ -5684,7 +5684,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
symtab = sds.symtab;
}
assert(symtab);
Identifier id = Identifier.generateId(s, symtab.length() + 1);
Identifier id = Identifier.generateIdWithLoc(s, exp.loc);
exp.fd.ident = id;
if (exp.td)
exp.td.ident = id;

View file

@ -8919,6 +8919,7 @@ struct Id final
static Identifier* isRef;
static Identifier* isOut;
static Identifier* isLazy;
static Identifier* isCOMClass;
static Identifier* hasMember;
static Identifier* identifier;
static Identifier* fullyQualifiedName;

View file

@ -482,6 +482,7 @@ immutable Msgtable[] msgtable =
{ "isRef" },
{ "isOut" },
{ "isLazy" },
{ "isCOMClass" },
{ "hasMember" },
{ "identifier" },
{ "fullyQualifiedName" },

View file

@ -701,6 +701,26 @@ Expression semanticTraits(TraitsExp e, Scope* sc)
return isDeclX(d => (d.storage_class & STC.lazy_) != 0);
}
if (e.ident == Id.isCOMClass)
{
if (dim != 1)
return dimError(1);
auto o = (*e.args)[0];
auto s = getDsymbol(o);
AggregateDeclaration agg;
if (!s || ((agg = s.isAggregateDeclaration()) is null))
{
error(e.loc, "argument to `__traits(isCOMClass, %s)` is not a declaration", o.toChars());
return ErrorExp.get();
}
if (ClassDeclaration cd = agg.isClassDeclaration())
return cd.com ? True() : False();
else
return False();
}
if (e.ident == Id.identifier)
{
// Get identifier for symbol as a string literal