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

Delta Between Two Patch Sets: src/cmd/gc/go.y

Issue 6906056: cmd/gc: recycle Nodes from discarded imported methods. (Closed)
Left Patch Set: diff -r 6b602ab487d6 https://code.google.com/p/go Created 11 years, 3 months ago
Right Patch Set: diff -r 6b602ab487d6 https://code.google.com/p/go Created 11 years, 3 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/cmd/gc/go.h ('k') | src/cmd/gc/lex.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
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 * Go language grammar. 6 * Go language grammar.
7 * 7 *
8 * The Go semicolon rules are: 8 * The Go semicolon rules are:
9 * 9 *
10 * 1. all statements and declarations are terminated by semicolons. 10 * 1. all statements and declarations are terminated by semicolons.
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 declare($$, PFUNC); 1337 declare($$, PFUNC);
1338 1338
1339 funchdr($$); 1339 funchdr($$);
1340 } 1340 }
1341 | '(' hidden_funarg_list ')' sym '(' ohidden_funarg_list ')' ohidden_funre s 1341 | '(' hidden_funarg_list ')' sym '(' ohidden_funarg_list ')' ohidden_funre s
1342 { 1342 {
1343 $$ = methodname1(newname($4), $2->n->right);· 1343 $$ = methodname1(newname($4), $2->n->right);·
1344 $$->type = functype($2->n, $6, $8); 1344 $$->type = functype($2->n, $6, $8);
1345 1345
1346 checkwidth($$->type); 1346 checkwidth($$->type);
1347 thingsused++;
1347 if(addmethod($4, $$->type, 0, nointerface)) { 1348 if(addmethod($4, $$->type, 0, nointerface)) {
1348 // repeated add 1349 // repeated add
1349 dclcontext = PDISCARD; // since we skip funchdr below 1350 dclcontext = PDISCARD; // since we skip funchdr below
1350 » » » freenode($$); 1351 » » » freenode($$); // TODO find more recyclable nodes from - >type
1351 $$ = N; 1352 $$ = N;
1352 break; 1353 break;
1353 } 1354 }
1354 1355 » » thingsallocs++;
1355 nointerface = 0; 1356 nointerface = 0;
1356 funchdr($$); 1357 funchdr($$);
1357 ················ 1358 ················
1358 // inl.c's inlnode in on a dotmeth node expects to find the inli neable body as 1359 // inl.c's inlnode in on a dotmeth node expects to find the inli neable body as
1359 // (dotmeth's type)->nname->inl, and dotmeth's type has been pul led 1360 // (dotmeth's type)->nname->inl, and dotmeth's type has been pul led
1360 // out by typecheck's lookdot as this $$->ttype. So by providin g 1361 // out by typecheck's lookdot as this $$->ttype. So by providin g
1361 // this back link here we avoid special casing there. 1362 // this back link here we avoid special casing there.
1362 $$->type->nname = $$; 1363 $$->type->nname = $$;
1363 } 1364 }
1364 1365
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
2133 static void 2134 static void
2134 fixlbrace(int lbr) 2135 fixlbrace(int lbr)
2135 { 2136 {
2136 // If the opening brace was an LBODY, 2137 // If the opening brace was an LBODY,
2137 // set up for another one now that we're done. 2138 // set up for another one now that we're done.
2138 // See comment in lex.c about loophack. 2139 // See comment in lex.c about loophack.
2139 if(lbr == LBODY) 2140 if(lbr == LBODY)
2140 loophack = 1; 2141 loophack = 1;
2141 } 2142 }
2142 2143
LEFTRIGHT

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