~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to src/cmd/gc/range.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
        if(n->list->next)
73
73
                v2 = n->list->next->n;
74
74
 
 
75
        // this is not only a optimization but also a requirement in the spec.
 
76
        // "if the second iteration variable is the blank identifier, the range
 
77
        // clause is equivalent to the same clause with only the first variable
 
78
        // present."
 
79
        if(isblank(v2)) {
 
80
                n->list = list1(v1);
 
81
                v2 = N;
 
82
        }
 
83
 
75
84
        if(v1->defn == n)
76
85
                v1->type = t1;
77
86
        else if(v1->type != T && assignop(t1, v1->type, &why) == 0)
145
154
                if(v2) {
146
155
                        hp = temp(ptrto(n->type->type));
147
156
                        tmp = nod(OINDEX, ha, nodintconst(0));
148
 
                        tmp->etype = 1; // no bounds check
 
157
                        tmp->bounded = 1;
149
158
                        init = list(init, nod(OAS, hp, nod(OADDR, tmp, N)));
150
159
                }
151
160
 
172
181
        case TMAP:
173
182
                th = typ(TARRAY);
174
183
                th->type = ptrto(types[TUINT8]);
175
 
                // see ../../pkg/runtime/hashmap.h:/hash_iter
176
 
                // Size in words.
177
 
                th->bound = 5 + 4*3 + 4*4/widthptr;
 
184
                // see ../../pkg/runtime/hashmap.c:/hash_iter
 
185
                // Size of hash_iter in # of pointers.
 
186
                th->bound = 11;
178
187
                hit = temp(th);
179
188
 
180
189
                fn = syslook("mapiterinit", 1);