sourcepawn/compiler/sc3.c
changeset 156 8e78da8daaf0
parent 154 b0819acf3fba
child 163 6738267b2c09
     1.1 --- a/sourcepawn/compiler/sc3.c	Tue Nov 07 13:06:04 2006 +0000
     1.2 +++ b/sourcepawn/compiler/sc3.c	Tue Nov 07 23:26:40 2006 +0000
     1.3 @@ -1741,6 +1741,7 @@
     1.4    char *st;
     1.5    char close;
     1.6    symbol *sym;
     1.7 +  int magic_string=0;
     1.8    symbol dummysymbol,*cursym;   /* for changing the index tags in case of enumerated pseudo-arrays */
     1.9  
    1.10    lvalue=primary(lval1);
    1.11 @@ -1750,6 +1751,7 @@
    1.12    sym=cursym;
    1.13    if (matchtoken('[') || matchtoken('{') || matchtoken('(')) {
    1.14      tok=tokeninfo(&val,&st);    /* get token read by matchtoken() */
    1.15 +    magic_string = (sym->tag == pc_tag_string && sym->dim.array.level == 0);
    1.16      if (sym==NULL && symtok!=tSYMBOL) {
    1.17        /* we do not have a valid symbol and we appear not to have read a valid
    1.18         * symbol name (so it is unlikely that we would have read a name of an
    1.19 @@ -1834,7 +1836,7 @@
    1.20        } else {
    1.21          /* array index is not constant */
    1.22          lval1->arrayidx=NULL;           /* reset, so won't be checked */
    1.23 -        if (close==']') {
    1.24 +        if (close==']' && !magic_string) {
    1.25            if (sym->dim.array.length!=0)
    1.26              ffbounds(sym->dim.array.length-1);  /* run time check for array bounds */
    1.27            cell2addr();  /* normal array index */
    1.28 @@ -1845,7 +1847,7 @@
    1.29          } /* if */
    1.30          popreg(sALT);
    1.31          ob_add();       /* base address was popped into secondary register */
    1.32 -        if (close!=']')
    1.33 +        if (close!=']' || magic_string)
    1.34            charalign();  /* align character index into array */
    1.35        } /* if */
    1.36        /* the indexed item may be another array (multi-dimensional arrays) */