summaryrefslogtreecommitdiff
path: root/gcc/d/dmd/semantic3.d
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/d/dmd/semantic3.d')
-rw-r--r--gcc/d/dmd/semantic3.d22
1 files changed, 7 insertions, 15 deletions
diff --git a/gcc/d/dmd/semantic3.d b/gcc/d/dmd/semantic3.d
index 3f019669400..b706777a1ed 100644
--- a/gcc/d/dmd/semantic3.d
+++ b/gcc/d/dmd/semantic3.d
@@ -468,7 +468,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
{
stc |= STC.variadic;
auto vtypeb = vtype.toBasetype();
- if (vtypeb.ty == Tarray)
+ if (vtypeb.ty == Tarray || vtypeb.ty == Tclass)
{
/* Since it'll be pointing into the stack for the array
* contents, it needs to be `scope`
@@ -620,7 +620,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
funcdecl.checkDmain(); // Check main() parameters and return type
}
- if (global.params.vcomplex && f.next !is null)
+ if (f.next !is null)
f.next.checkComplexTransition(funcdecl.loc, sc);
if (funcdecl.returns && !funcdecl.fbody.isErrorStatement())
@@ -1292,17 +1292,13 @@ private extern(C++) final class Semantic3Visitor : Visitor
// Eliminate maybescope's
{
// Create and fill array[] with maybe candidates from the `this` and the parameters
- VarDeclaration[] array = void;
-
VarDeclaration[10] tmp = void;
size_t dim = (funcdecl.vthis !is null) + (funcdecl.parameters ? funcdecl.parameters.dim : 0);
- if (dim <= tmp.length)
- array = tmp[0 .. dim];
- else
- {
- auto ptr = cast(VarDeclaration*)mem.xmalloc(dim * VarDeclaration.sizeof);
- array = ptr[0 .. dim];
- }
+
+ import dmd.common.string : SmallBuffer;
+ auto sb = SmallBuffer!VarDeclaration(dim, tmp[]);
+ VarDeclaration[] array = sb[];
+
size_t n = 0;
if (funcdecl.vthis)
array[n++] = funcdecl.vthis;
@@ -1313,11 +1309,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
array[n++] = v;
}
}
-
eliminateMaybeScopes(array[0 .. n]);
-
- if (dim > tmp.length)
- mem.xfree(array.ptr);
}
// Infer STC.scope_