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

Delta Between Two Patch Sets: src/cmd/gc/typecheck.c

Issue 112570044: code review 112570044: cmd/gc, runtime: treat slices and strings like pointers... (Closed)
Left Patch Set: diff -r e5fa01e2f333 https://code.google.com/p/go/ Created 10 years, 8 months ago
Right Patch Set: diff -r 6d5c17d94e9ddcd8ca450ac62f84cf9ddb436b65 https://code.google.com/p/go/ Created 10 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:
Right: Side by side diff | Download
« no previous file with change/comment | « src/cmd/gc/subr.c ('k') | src/cmd/gc/walk.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 /* 5 /*
6 * type check the whole tree of an expression. 6 * type check the whole tree of an expression.
7 * calculates expression types. 7 * calculates expression types.
8 * evaluates compile time constants. 8 * evaluates compile time constants.
9 * marks variables that escape the local frame. 9 * marks variables that escape the local frame.
10 * rewrites n->op to be more specific in some cases. 10 * rewrites n->op to be more specific in some cases.
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 */ 517 */
518 case OASOP: 518 case OASOP:
519 ok |= Etop; 519 ok |= Etop;
520 l = typecheck(&n->left, Erv); 520 l = typecheck(&n->left, Erv);
521 checkassign(n->left); 521 checkassign(n->left);
522 r = typecheck(&n->right, Erv); 522 r = typecheck(&n->right, Erv);
523 if(l->type == T || r->type == T) 523 if(l->type == T || r->type == T)
524 goto error; 524 goto error;
525 op = n->etype; 525 op = n->etype;
526 goto arith; 526 goto arith;
527
528 case OADDPTR:
529 ok |= Erv;
530 l = typecheck(&n->left, Erv);
531 r = typecheck(&n->right, Erv);
532 if(l->type == T || r->type == T)
533 goto error;
534 if(l->type->etype != tptr)
535 fatal("bad OADDPTR left type %E for %N", l->type->etype, n->left);
536 if(r->type->etype != TUINTPTR)
537 fatal("bad OADDPTR right type %E for %N", r->type->etype , n->right);
538 n->type = types[tptr];
539 goto ret;
540 527
541 case OADD: 528 case OADD:
542 case OAND: 529 case OAND:
543 case OANDAND: 530 case OANDAND:
544 case OANDNOT: 531 case OANDNOT:
545 case ODIV: 532 case ODIV:
546 case OEQ: 533 case OEQ:
547 case OGE: 534 case OGE:
548 case OGT: 535 case OGT:
549 case OLE: 536 case OLE:
(...skipping 2977 matching lines...) Expand 10 before | Expand all | Expand 10 after
3527 return 0; 3514 return 0;
3528 } 3515 }
3529 3516
3530 void 3517 void
3531 checkreturn(Node *fn) 3518 checkreturn(Node *fn)
3532 { 3519 {
3533 if(fn->type->outtuple && fn->nbody != nil) 3520 if(fn->type->outtuple && fn->nbody != nil)
3534 if(!isterminating(fn->nbody, 1)) 3521 if(!isterminating(fn->nbody, 1))
3535 yyerrorl(fn->endlineno, "missing return at end of functi on"); 3522 yyerrorl(fn->endlineno, "missing return at end of functi on");
3536 } 3523 }
LEFTRIGHT

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