Allow dynamic char arrays.
This commit is contained in:
parent
cd0ac3ae37
commit
3cc5c198b4
@ -2171,7 +2171,7 @@ static void declloc(int tokid)
|
|||||||
//
|
//
|
||||||
// For now, we only implement the string literal initializer.
|
// For now, we only implement the string literal initializer.
|
||||||
if (type->is_new && needtoken('=')) {
|
if (type->is_new && needtoken('=')) {
|
||||||
if (type->isCharArray()) {
|
if (type->isCharArray() && !lexpeek(tNEW)) {
|
||||||
// Error if we're assigning something other than a string literal.
|
// Error if we're assigning something other than a string literal.
|
||||||
needtoken(tSTRING);
|
needtoken(tSTRING);
|
||||||
|
|
||||||
@ -2205,6 +2205,8 @@ static void declloc(int tokid)
|
|||||||
TRUE, FALSE, TRUE, FALSE,
|
TRUE, FALSE, TRUE, FALSE,
|
||||||
&type->idxtag[i],
|
&type->idxtag[i],
|
||||||
&child, 0, &val);
|
&child, 0, &val);
|
||||||
|
if (i == type->numdim - 1 && type->tag == pc_tag_string)
|
||||||
|
stradjust(sPRI);
|
||||||
pushreg(sPRI);
|
pushreg(sPRI);
|
||||||
|
|
||||||
switch (ident) {
|
switch (ident) {
|
||||||
|
5
sourcepawn/compiler/tests/ok-dynamic-char.sp
Normal file
5
sourcepawn/compiler/tests/ok-dynamic-char.sp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
public OnPluginStart()
|
||||||
|
{
|
||||||
|
char[] x = new char[500];
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user