Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(599)

Side by Side Diff: src/cmd/gc/walk.c

Issue 4964046: code review 4964046: src/cmd/gc/*: Adjustments for compilation using Plan 9 ... (Closed)
Patch Set: diff -r 5e1053337103 https://go.googlecode.com/hg/ Created 13 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/cmd/gc/typecheck.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 #include <u.h> 5 #include <u.h>
6 #include <libc.h> 6 #include <libc.h>
7 #include "go.h" 7 #include "go.h"
8 8
9 static Node* walkprint(Node*, NodeList**, int); 9 static Node* walkprint(Node*, NodeList**, int);
10 static Node* conv(Node*, Type*); 10 static Node* conv(Node*, Type*);
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 lno = setlineno(n); 373 lno = setlineno(n);
374 374
375 if(debug['w'] > 1) 375 if(debug['w'] > 1)
376 dump("walk-before", n); 376 dump("walk-before", n);
377 377
378 if(n->typecheck != 1) { 378 if(n->typecheck != 1) {
379 dump("missed typecheck", n); 379 dump("missed typecheck", n);
380 fatal("missed typecheck"); 380 fatal("missed typecheck");
381 } 381 }
382 382
383 t = T;
384 et = Txxx;
385
386 switch(n->op) { 383 switch(n->op) {
387 default: 384 default:
388 dump("walk", n); 385 dump("walk", n);
389 fatal("walkexpr: switch 1 unknown op %N", n); 386 fatal("walkexpr: switch 1 unknown op %N", n);
390 » » goto ret; 387 » » break;
391 388
392 case OTYPE: 389 case OTYPE:
393 case ONONAME: 390 case ONONAME:
394 case OINDREG: 391 case OINDREG:
395 case OEMPTY: 392 case OEMPTY:
396 goto ret; 393 goto ret;
397 394
398 case ONOT: 395 case ONOT:
399 case OMINUS: 396 case OMINUS:
400 case OPLUS: 397 case OPLUS:
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 static char* 1339 static char*
1343 dumptypes(Type **nl, char *what) 1340 dumptypes(Type **nl, char *what)
1344 { 1341 {
1345 int first; 1342 int first;
1346 Type *l; 1343 Type *l;
1347 Iter savel; 1344 Iter savel;
1348 Fmt fmt; 1345 Fmt fmt;
1349 1346
1350 fmtstrinit(&fmt); 1347 fmtstrinit(&fmt);
1351 fmtprint(&fmt, "\t"); 1348 fmtprint(&fmt, "\t");
1352 l = structfirst(&savel, nl);
1353 first = 1; 1349 first = 1;
1354 for(l = structfirst(&savel, nl); l != T; l = structnext(&savel)) { 1350 for(l = structfirst(&savel, nl); l != T; l = structnext(&savel)) {
1355 if(first) 1351 if(first)
1356 first = 0; 1352 first = 0;
1357 else 1353 else
1358 fmtprint(&fmt, ", "); 1354 fmtprint(&fmt, ", ");
1359 fmtprint(&fmt, "%T", l); 1355 fmtprint(&fmt, "%T", l);
1360 } 1356 }
1361 if(first) 1357 if(first)
1362 fmtprint(&fmt, "[no arguments %s]", what); 1358 fmtprint(&fmt, "[no arguments %s]", what);
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 } 1715 }
1720 1716
1721 /* 1717 /*
1722 * from ascompat[te] 1718 * from ascompat[te]
1723 * evaluating actual function arguments. 1719 * evaluating actual function arguments.
1724 * f(a,b) 1720 * f(a,b)
1725 * if there is exactly one function expr, 1721 * if there is exactly one function expr,
1726 * then it is done first. otherwise must 1722 * then it is done first. otherwise must
1727 * make temp variables 1723 * make temp variables
1728 */ 1724 */
1729 NodeList* 1725 static NodeList*
1730 reorder1(NodeList *all) 1726 reorder1(NodeList *all)
1731 { 1727 {
1732 Node *f, *a, *n; 1728 Node *f, *a, *n;
1733 NodeList *l, *r, *g; 1729 NodeList *l, *r, *g;
1734 int c, d, t; 1730 int c, d, t;
1735 1731
1736 c = 0; // function calls 1732 c = 0; // function calls
1737 t = 0; // total parameters 1733 t = 0; // total parameters
1738 1734
1739 for(l=all; l; l=l->next) { 1735 for(l=all; l; l=l->next) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 if(vmatch1(l->left, r)) 1841 if(vmatch1(l->left, r))
1846 return 1; 1842 return 1;
1847 if(vmatch1(l->right, r)) 1843 if(vmatch1(l->right, r))
1848 return 1; 1844 return 1;
1849 for(ll=l->list; ll; ll=ll->next) 1845 for(ll=l->list; ll; ll=ll->next)
1850 if(vmatch1(ll->n, r)) 1846 if(vmatch1(ll->n, r))
1851 return 1; 1847 return 1;
1852 return 0; 1848 return 0;
1853 } 1849 }
1854 1850
1855 NodeList* 1851 static NodeList*
1856 reorder3(NodeList *all) 1852 reorder3(NodeList *all)
1857 { 1853 {
1858 Node *n1, *n2, *q; 1854 Node *n1, *n2, *q;
1859 int c1, c2; 1855 int c1, c2;
1860 NodeList *l1, *l2, *r; 1856 NodeList *l1, *l2, *r;
1861 1857
1862 r = nil; 1858 r = nil;
1863 for(l1=all, c1=0; l1; l1=l1->next, c1++) { 1859 for(l1=all, c1=0; l1; l1=l1->next, c1++) {
1864 n1 = l1->n; 1860 n1 = l1->n;
1865 for(l2=all, c2=0; l2; l2=l2->next, c2++) { 1861 for(l2=all, c2=0; l2; l2=l2->next, c2++) {
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
2163 l = list(l, nod(OAS, nx, a->n)); // s[n] = arg 2159 l = list(l, nod(OAS, nx, a->n)); // s[n] = arg
2164 if (a->next != nil) 2160 if (a->next != nil)
2165 l = list(l, nod(OAS, nn, nod(OADD, nn, nodintconst(1)))) ; // n = n + 1 2161 l = list(l, nod(OAS, nn, nod(OADD, nn, nodintconst(1)))) ; // n = n + 1
2166 } 2162 }
2167 2163
2168 typechecklist(l, Etop); 2164 typechecklist(l, Etop);
2169 walkstmtlist(l); 2165 walkstmtlist(l);
2170 *init = concat(*init, l); 2166 *init = concat(*init, l);
2171 return ns; 2167 return ns;
2172 } 2168 }
OLDNEW
« no previous file with comments | « src/cmd/gc/typecheck.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b