From f80757542944b5ca961e2bbdb650e094b56a4dbe Mon Sep 17 00:00:00 2001 From: Borja Ferrer Date: Sat, 9 Dec 2006 03:18:48 +0000 Subject: [PATCH] fixed arrays using decl being init when assigning a number --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40207 --- sourcepawn/compiler/sc1.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index f221e6fe..91a49386 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -2502,6 +2502,10 @@ static void initials(int ident,int tag,cell *size,int dim[],int numdim, int curlit=litidx; int err=0; + if (!autozero) { + return; + } + if (!matchtoken('=')) { assert(ident!=iARRAY || numdim>0); if (ident==iARRAY && dim[numdim-1]==0) { @@ -2662,12 +2666,12 @@ static cell initvector(int ident,int tag,cell size,int fillzero, constvalue *enumroot,int *errorfound) { cell prev1=0,prev2=0; - int ellips=FALSE,hadtoken=0; + int ellips=FALSE; int curlit=litidx; int rtag,ctag; assert(ident==iARRAY || ident==iREFARRAY); - if ((hadtoken=matchtoken('{')) && autozero) { + if (matchtoken('{')) { constvalue *enumfield=(enumroot!=NULL) ? enumroot->next : NULL; do { int fieldlit=litidx; @@ -2729,11 +2733,6 @@ static cell initvector(int ident,int tag,cell size,int fillzero, } while (matchtoken(',')); /* do */ needtoken('}'); } else { - if (hadtoken && !autozero) { - error(10); - lexclr(TRUE); /* drop the rest of the line */ - return 0; - } init(ident,&ctag,errorfound); if (!matchtag(tag,ctag,TRUE)) error(213); /* tagname mismatch */