Commit 530147e8 authored by Luuk van Dijk's avatar Luuk van Dijk

cmd/gc: inlining functions with local variables

- make sure dclcontext == PAUTO only in function bodies
- introduce PDISCARD to discard declarations in bodies of repeated imports
- skip printing initializing OAS'es in export mode, assuming they only occur after ODCL's
- remove ODCL and the initializing OAS from inl.c:ishairy
- fix confused use of ->typecheck in typecheckinl: it's about the ->inl, not about the fn.
- debuging aids: print ntype on ONAMEs too and -Emm instead of -Ell.

fixes #2812

R=rsc
CC=golang-dev
https://golang.org/cl/6800043
parent 507fcf37
...@@ -172,6 +172,9 @@ declare(Node *n, int ctxt) ...@@ -172,6 +172,9 @@ declare(Node *n, int ctxt)
Sym *s; Sym *s;
int gen; int gen;
static int typegen, vargen; static int typegen, vargen;
if(ctxt == PDISCARD)
return;
if(isblank(n)) if(isblank(n))
return; return;
...@@ -240,7 +243,7 @@ variter(NodeList *vl, Node *t, NodeList *el) ...@@ -240,7 +243,7 @@ variter(NodeList *vl, Node *t, NodeList *el)
init = nil; init = nil;
doexpr = el != nil; doexpr = el != nil;
if(count(el) == 1 && count(vl) > 1) { if(count(el) == 1 && count(vl) > 1) {
e = el->n; e = el->n;
as2 = nod(OAS2, N, N); as2 = nod(OAS2, N, N);
......
...@@ -813,6 +813,12 @@ stmtfmt(Fmt *f, Node *n) ...@@ -813,6 +813,12 @@ stmtfmt(Fmt *f, Node *n)
break; break;
case OAS: case OAS:
// Don't export "v = <N>" initializing statements, hope they're always
// preceded by the DCL which will be re-parsed and typecheck to reproduce
// the "v = <N>" again.
if(fmtmode == FExp && n->right == N)
break;
if(n->colas && !complexinit) if(n->colas && !complexinit)
fmtprint(f, "%N := %N", n->left, n->right); fmtprint(f, "%N := %N", n->left, n->right);
else else
...@@ -1431,6 +1437,10 @@ nodedump(Fmt *fp, Node *n) ...@@ -1431,6 +1437,10 @@ nodedump(Fmt *fp, Node *n)
fmtprint(fp, "%O-%S%J", n->op, n->sym, n); fmtprint(fp, "%O-%S%J", n->op, n->sym, n);
else else
fmtprint(fp, "%O%J", n->op, n); fmtprint(fp, "%O%J", n->op, n);
if(recur && n->type == T && n->ntype) {
indent(fp);
fmtprint(fp, "%O-ntype%N", n->op, n->ntype);
}
break; break;
case OASOP: case OASOP:
fmtprint(fp, "%O-%O%J", n->op, n->etype, n); fmtprint(fp, "%O-%O%J", n->op, n->etype, n);
......
...@@ -649,6 +649,8 @@ enum ...@@ -649,6 +649,8 @@ enum
PPARAMREF, // param passed by reference PPARAMREF, // param passed by reference
PFUNC, PFUNC,
PDISCARD, // discard during parse of duplicate import
PHEAP = 1<<7, PHEAP = 1<<7,
}; };
......
...@@ -1293,8 +1293,10 @@ hidden_fndcl: ...@@ -1293,8 +1293,10 @@ hidden_fndcl:
importsym(s, ONAME); importsym(s, ONAME);
if(s->def != N && s->def->op == ONAME) { if(s->def != N && s->def->op == ONAME) {
if(eqtype(t, s->def->type)) if(eqtype(t, s->def->type)) {
dclcontext = PDISCARD; // since we skip funchdr below
break; break;
}
yyerror("inconsistent definition for func %S during import\n\t%T\n\t%T", s, s->def->type, t); yyerror("inconsistent definition for func %S during import\n\t%T\n\t%T", s, s->def->type, t);
} }
...@@ -1824,8 +1826,10 @@ hidden_import: ...@@ -1824,8 +1826,10 @@ hidden_import:
} }
| LFUNC hidden_fndcl fnbody ';' | LFUNC hidden_fndcl fnbody ';'
{ {
if($2 == N) if($2 == N) {
dclcontext = PEXTERN; // since we skip the funcbody below
break; break;
}
$2->inl = $3; $2->inl = $3;
...@@ -1834,7 +1838,7 @@ hidden_import: ...@@ -1834,7 +1838,7 @@ hidden_import:
if(debug['E']) { if(debug['E']) {
print("import [%Z] func %lN \n", importpkg->path, $2); print("import [%Z] func %lN \n", importpkg->path, $2);
if(debug['l'] > 2 && $2->inl) if(debug['m'] > 2 && $2->inl)
print("inl body:%+H\n", $2->inl); print("inl body:%+H\n", $2->inl);
} }
} }
......
...@@ -82,20 +82,18 @@ typecheckinl(Node *fn) ...@@ -82,20 +82,18 @@ typecheckinl(Node *fn)
Pkg *pkg; Pkg *pkg;
int save_safemode, lno; int save_safemode, lno;
if(fn->typecheck)
return;
lno = setlineno(fn); lno = setlineno(fn);
if (debug['m']>2) // typecheckinl is only for imported functions;
print("typecheck import [%S] %lN { %#H }\n", fn->sym, fn, fn->inl);
// typecheckinl is only used for imported functions;
// their bodies may refer to unsafe as long as the package // their bodies may refer to unsafe as long as the package
// was marked safe during import (which was checked then). // was marked safe during import (which was checked then).
// the ->inl of a local function has been typechecked before caninl copied it.
pkg = fnpkg(fn); pkg = fnpkg(fn);
if (pkg == localpkg || pkg == nil) if (pkg == localpkg || pkg == nil)
fatal("typecheckinl on local function %lN", fn); return; // typecheckinl on local function
if (debug['m']>2)
print("typecheck import [%S] %lN { %#H }\n", fn->sym, fn, fn->inl);
save_safemode = safemode; save_safemode = safemode;
safemode = 0; safemode = 0;
...@@ -103,7 +101,6 @@ typecheckinl(Node *fn) ...@@ -103,7 +101,6 @@ typecheckinl(Node *fn)
savefn = curfn; savefn = curfn;
curfn = fn; curfn = fn;
typechecklist(fn->inl, Etop); typechecklist(fn->inl, Etop);
fn->typecheck = 1;
curfn = savefn; curfn = savefn;
safemode = save_safemode; safemode = save_safemode;
...@@ -113,6 +110,7 @@ typecheckinl(Node *fn) ...@@ -113,6 +110,7 @@ typecheckinl(Node *fn)
// Caninl determines whether fn is inlineable. // Caninl determines whether fn is inlineable.
// If so, caninl saves fn->nbody in fn->inl and substitutes it with a copy. // If so, caninl saves fn->nbody in fn->inl and substitutes it with a copy.
// fn and ->nbody will already have been typechecked.
void void
caninl(Node *fn) caninl(Node *fn)
{ {
...@@ -129,6 +127,9 @@ caninl(Node *fn) ...@@ -129,6 +127,9 @@ caninl(Node *fn)
if(fn->nbody == nil) if(fn->nbody == nil)
return; return;
if(fn->typecheck == 0)
fatal("caninl on non-typechecked function %N", fn);
// can't handle ... args yet // can't handle ... args yet
for(t=fn->type->type->down->down->type; t; t=t->down) for(t=fn->type->type->down->down->type; t; t=t->down)
if(t->isddd) if(t->isddd)
...@@ -143,8 +144,6 @@ caninl(Node *fn) ...@@ -143,8 +144,6 @@ caninl(Node *fn)
fn->nname->inl = fn->nbody; fn->nname->inl = fn->nbody;
fn->nbody = inlcopylist(fn->nname->inl); fn->nbody = inlcopylist(fn->nname->inl);
// nbody will have been typechecked, so we can set this:
fn->typecheck = 1;
// hack, TODO, check for better way to link method nodes back to the thing with the ->inl // hack, TODO, check for better way to link method nodes back to the thing with the ->inl
// this is so export can find the body of a method // this is so export can find the body of a method
...@@ -193,19 +192,11 @@ ishairy(Node *n, int *budget) ...@@ -193,19 +192,11 @@ ishairy(Node *n, int *budget)
case OSWITCH: case OSWITCH:
case OPROC: case OPROC:
case ODEFER: case ODEFER:
case ODCL: // declares locals as globals b/c of @"". qualification
case ODCLTYPE: // can't print yet case ODCLTYPE: // can't print yet
case ODCLCONST: // can't print yet case ODCLCONST: // can't print yet
return 1; return 1;
break; break;
case OAS:
// x = <N> zero initializing assignments aren't representible in export yet.
// alternatively we may just skip them in printing and hope their DCL printed
// as a var will regenerate it
if(n->right == N)
return 1;
break;
} }
(*budget)--; (*budget)--;
......
...@@ -674,21 +674,21 @@ static const yytype_uint16 yyrline[] = ...@@ -674,21 +674,21 @@ static const yytype_uint16 yyrline[] =
1098, 1099, 1100, 1101, 1107, 1108, 1111, 1114, 1115, 1116, 1098, 1099, 1100, 1101, 1107, 1108, 1111, 1114, 1115, 1116,
1117, 1118, 1121, 1122, 1135, 1139, 1144, 1149, 1154, 1158, 1117, 1118, 1121, 1122, 1135, 1139, 1144, 1149, 1154, 1158,
1159, 1162, 1168, 1175, 1181, 1188, 1194, 1205, 1216, 1245, 1159, 1162, 1168, 1175, 1181, 1188, 1194, 1205, 1216, 1245,
1284, 1307, 1324, 1333, 1336, 1344, 1348, 1352, 1359, 1365, 1284, 1309, 1326, 1335, 1338, 1346, 1350, 1354, 1361, 1367,
1370, 1382, 1385, 1393, 1394, 1400, 1401, 1407, 1411, 1417, 1372, 1384, 1387, 1395, 1396, 1402, 1403, 1409, 1413, 1419,
1418, 1424, 1428, 1434, 1457, 1462, 1468, 1474, 1481, 1490, 1420, 1426, 1430, 1436, 1459, 1464, 1470, 1476, 1483, 1492,
1499, 1514, 1520, 1525, 1529, 1536, 1549, 1550, 1556, 1562, 1501, 1516, 1522, 1527, 1531, 1538, 1551, 1552, 1558, 1564,
1565, 1569, 1575, 1578, 1587, 1590, 1591, 1595, 1596, 1602, 1567, 1571, 1577, 1580, 1589, 1592, 1593, 1597, 1598, 1604,
1603, 1604, 1605, 1606, 1608, 1607, 1622, 1627, 1631, 1635, 1605, 1606, 1607, 1608, 1610, 1609, 1624, 1629, 1633, 1637,
1639, 1643, 1648, 1667, 1673, 1681, 1685, 1691, 1695, 1701, 1641, 1645, 1650, 1669, 1675, 1683, 1687, 1693, 1697, 1703,
1705, 1711, 1715, 1724, 1728, 1732, 1736, 1742, 1745, 1753, 1707, 1713, 1717, 1726, 1730, 1734, 1738, 1744, 1747, 1755,
1754, 1756, 1757, 1760, 1763, 1766, 1769, 1772, 1775, 1778, 1756, 1758, 1759, 1762, 1765, 1768, 1771, 1774, 1777, 1780,
1781, 1784, 1787, 1790, 1793, 1796, 1799, 1805, 1809, 1813, 1783, 1786, 1789, 1792, 1795, 1798, 1801, 1807, 1811, 1815,
1817, 1821, 1825, 1843, 1850, 1861, 1862, 1863, 1866, 1867, 1819, 1823, 1827, 1847, 1854, 1865, 1866, 1867, 1870, 1871,
1870, 1874, 1884, 1888, 1892, 1896, 1900, 1904, 1908, 1914, 1874, 1878, 1888, 1892, 1896, 1900, 1904, 1908, 1912, 1918,
1920, 1928, 1936, 1942, 1949, 1965, 1983, 1987, 1993, 1996, 1924, 1932, 1940, 1946, 1953, 1969, 1987, 1991, 1997, 2000,
1999, 2003, 2013, 2017, 2032, 2040, 2041, 2053, 2054, 2057, 2003, 2007, 2017, 2021, 2036, 2044, 2045, 2057, 2058, 2061,
2061, 2067, 2071, 2077, 2081 2065, 2071, 2075, 2081, 2085
}; };
#endif #endif
...@@ -3750,8 +3750,10 @@ yyreduce: ...@@ -3750,8 +3750,10 @@ yyreduce:
importsym(s, ONAME); importsym(s, ONAME);
if(s->def != N && s->def->op == ONAME) { if(s->def != N && s->def->op == ONAME) {
if(eqtype(t, s->def->type)) if(eqtype(t, s->def->type)) {
dclcontext = PDISCARD; // since we skip funchdr below
break; break;
}
yyerror("inconsistent definition for func %S during import\n\t%T\n\t%T", s, s->def->type, t); yyerror("inconsistent definition for func %S during import\n\t%T\n\t%T", s, s->def->type, t);
} }
...@@ -3764,7 +3766,7 @@ yyreduce: ...@@ -3764,7 +3766,7 @@ yyreduce:
break; break;
case 201: case 201:
#line 1308 "go.y" #line 1310 "go.y"
{ {
(yyval.node) = methodname1(newname((yyvsp[(4) - (8)].sym)), (yyvsp[(2) - (8)].list)->n->right); (yyval.node) = methodname1(newname((yyvsp[(4) - (8)].sym)), (yyvsp[(2) - (8)].list)->n->right);
(yyval.node)->type = functype((yyvsp[(2) - (8)].list)->n, (yyvsp[(6) - (8)].list), (yyvsp[(8) - (8)].list)); (yyval.node)->type = functype((yyvsp[(2) - (8)].list)->n, (yyvsp[(6) - (8)].list), (yyvsp[(8) - (8)].list));
...@@ -3782,7 +3784,7 @@ yyreduce: ...@@ -3782,7 +3784,7 @@ yyreduce:
break; break;
case 202: case 202:
#line 1325 "go.y" #line 1327 "go.y"
{ {
(yyvsp[(3) - (5)].list) = checkarglist((yyvsp[(3) - (5)].list), 1); (yyvsp[(3) - (5)].list) = checkarglist((yyvsp[(3) - (5)].list), 1);
(yyval.node) = nod(OTFUNC, N, N); (yyval.node) = nod(OTFUNC, N, N);
...@@ -3792,14 +3794,14 @@ yyreduce: ...@@ -3792,14 +3794,14 @@ yyreduce:
break; break;
case 203: case 203:
#line 1333 "go.y" #line 1335 "go.y"
{ {
(yyval.list) = nil; (yyval.list) = nil;
} }
break; break;
case 204: case 204:
#line 1337 "go.y" #line 1339 "go.y"
{ {
(yyval.list) = (yyvsp[(2) - (3)].list); (yyval.list) = (yyvsp[(2) - (3)].list);
if((yyval.list) == nil) if((yyval.list) == nil)
...@@ -3808,21 +3810,21 @@ yyreduce: ...@@ -3808,21 +3810,21 @@ yyreduce:
break; break;
case 205: case 205:
#line 1345 "go.y" #line 1347 "go.y"
{ {
(yyval.list) = nil; (yyval.list) = nil;
} }
break; break;
case 206: case 206:
#line 1349 "go.y" #line 1351 "go.y"
{ {
(yyval.list) = list1(nod(ODCLFIELD, N, (yyvsp[(1) - (1)].node))); (yyval.list) = list1(nod(ODCLFIELD, N, (yyvsp[(1) - (1)].node)));
} }
break; break;
case 207: case 207:
#line 1353 "go.y" #line 1355 "go.y"
{ {
(yyvsp[(2) - (3)].list) = checkarglist((yyvsp[(2) - (3)].list), 0); (yyvsp[(2) - (3)].list) = checkarglist((yyvsp[(2) - (3)].list), 0);
(yyval.list) = (yyvsp[(2) - (3)].list); (yyval.list) = (yyvsp[(2) - (3)].list);
...@@ -3830,14 +3832,14 @@ yyreduce: ...@@ -3830,14 +3832,14 @@ yyreduce:
break; break;
case 208: case 208:
#line 1360 "go.y" #line 1362 "go.y"
{ {
closurehdr((yyvsp[(1) - (1)].node)); closurehdr((yyvsp[(1) - (1)].node));
} }
break; break;
case 209: case 209:
#line 1366 "go.y" #line 1368 "go.y"
{ {
(yyval.node) = closurebody((yyvsp[(3) - (4)].list)); (yyval.node) = closurebody((yyvsp[(3) - (4)].list));
fixlbrace((yyvsp[(2) - (4)].i)); fixlbrace((yyvsp[(2) - (4)].i));
...@@ -3845,21 +3847,21 @@ yyreduce: ...@@ -3845,21 +3847,21 @@ yyreduce:
break; break;
case 210: case 210:
#line 1371 "go.y" #line 1373 "go.y"
{ {
(yyval.node) = closurebody(nil); (yyval.node) = closurebody(nil);
} }
break; break;
case 211: case 211:
#line 1382 "go.y" #line 1384 "go.y"
{ {
(yyval.list) = nil; (yyval.list) = nil;
} }
break; break;
case 212: case 212:
#line 1386 "go.y" #line 1388 "go.y"
{ {
(yyval.list) = concat((yyvsp[(1) - (3)].list), (yyvsp[(2) - (3)].list)); (yyval.list) = concat((yyvsp[(1) - (3)].list), (yyvsp[(2) - (3)].list));
if(nsyntaxerrors == 0) if(nsyntaxerrors == 0)
...@@ -3868,56 +3870,56 @@ yyreduce: ...@@ -3868,56 +3870,56 @@ yyreduce:
break; break;
case 214: case 214:
#line 1395 "go.y" #line 1397 "go.y"
{ {
(yyval.list) = concat((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); (yyval.list) = concat((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list));
} }
break; break;
case 216: case 216:
#line 1402 "go.y" #line 1404 "go.y"
{ {
(yyval.list) = concat((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); (yyval.list) = concat((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list));
} }
break; break;
case 217: case 217:
#line 1408 "go.y" #line 1410 "go.y"
{ {
(yyval.list) = list1((yyvsp[(1) - (1)].node)); (yyval.list) = list1((yyvsp[(1) - (1)].node));
} }
break; break;
case 218: case 218:
#line 1412 "go.y" #line 1414 "go.y"
{ {
(yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node));
} }
break; break;
case 220: case 220:
#line 1419 "go.y" #line 1421 "go.y"
{ {
(yyval.list) = concat((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); (yyval.list) = concat((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list));
} }
break; break;
case 221: case 221:
#line 1425 "go.y" #line 1427 "go.y"
{ {
(yyval.list) = list1((yyvsp[(1) - (1)].node)); (yyval.list) = list1((yyvsp[(1) - (1)].node));
} }
break; break;
case 222: case 222:
#line 1429 "go.y" #line 1431 "go.y"
{ {
(yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node));
} }
break; break;
case 223: case 223:
#line 1435 "go.y" #line 1437 "go.y"
{ {
NodeList *l; NodeList *l;
...@@ -3943,7 +3945,7 @@ yyreduce: ...@@ -3943,7 +3945,7 @@ yyreduce:
break; break;
case 224: case 224:
#line 1458 "go.y" #line 1460 "go.y"
{ {
(yyvsp[(1) - (2)].node)->val = (yyvsp[(2) - (2)].val); (yyvsp[(1) - (2)].node)->val = (yyvsp[(2) - (2)].val);
(yyval.list) = list1((yyvsp[(1) - (2)].node)); (yyval.list) = list1((yyvsp[(1) - (2)].node));
...@@ -3951,7 +3953,7 @@ yyreduce: ...@@ -3951,7 +3953,7 @@ yyreduce:
break; break;
case 225: case 225:
#line 1463 "go.y" #line 1465 "go.y"
{ {
(yyvsp[(2) - (4)].node)->val = (yyvsp[(4) - (4)].val); (yyvsp[(2) - (4)].node)->val = (yyvsp[(4) - (4)].val);
(yyval.list) = list1((yyvsp[(2) - (4)].node)); (yyval.list) = list1((yyvsp[(2) - (4)].node));
...@@ -3960,7 +3962,7 @@ yyreduce: ...@@ -3960,7 +3962,7 @@ yyreduce:
break; break;
case 226: case 226:
#line 1469 "go.y" #line 1471 "go.y"
{ {
(yyvsp[(2) - (3)].node)->right = nod(OIND, (yyvsp[(2) - (3)].node)->right, N); (yyvsp[(2) - (3)].node)->right = nod(OIND, (yyvsp[(2) - (3)].node)->right, N);
(yyvsp[(2) - (3)].node)->val = (yyvsp[(3) - (3)].val); (yyvsp[(2) - (3)].node)->val = (yyvsp[(3) - (3)].val);
...@@ -3969,7 +3971,7 @@ yyreduce: ...@@ -3969,7 +3971,7 @@ yyreduce:
break; break;
case 227: case 227:
#line 1475 "go.y" #line 1477 "go.y"
{ {
(yyvsp[(3) - (5)].node)->right = nod(OIND, (yyvsp[(3) - (5)].node)->right, N); (yyvsp[(3) - (5)].node)->right = nod(OIND, (yyvsp[(3) - (5)].node)->right, N);
(yyvsp[(3) - (5)].node)->val = (yyvsp[(5) - (5)].val); (yyvsp[(3) - (5)].node)->val = (yyvsp[(5) - (5)].val);
...@@ -3979,7 +3981,7 @@ yyreduce: ...@@ -3979,7 +3981,7 @@ yyreduce:
break; break;
case 228: case 228:
#line 1482 "go.y" #line 1484 "go.y"
{ {
(yyvsp[(3) - (5)].node)->right = nod(OIND, (yyvsp[(3) - (5)].node)->right, N); (yyvsp[(3) - (5)].node)->right = nod(OIND, (yyvsp[(3) - (5)].node)->right, N);
(yyvsp[(3) - (5)].node)->val = (yyvsp[(5) - (5)].val); (yyvsp[(3) - (5)].node)->val = (yyvsp[(5) - (5)].val);
...@@ -3989,7 +3991,7 @@ yyreduce: ...@@ -3989,7 +3991,7 @@ yyreduce:
break; break;
case 229: case 229:
#line 1491 "go.y" #line 1493 "go.y"
{ {
Node *n; Node *n;
...@@ -4001,7 +4003,7 @@ yyreduce: ...@@ -4001,7 +4003,7 @@ yyreduce:
break; break;
case 230: case 230:
#line 1500 "go.y" #line 1502 "go.y"
{ {
Pkg *pkg; Pkg *pkg;
...@@ -4017,14 +4019,14 @@ yyreduce: ...@@ -4017,14 +4019,14 @@ yyreduce:
break; break;
case 231: case 231:
#line 1515 "go.y" #line 1517 "go.y"
{ {
(yyval.node) = embedded((yyvsp[(1) - (1)].sym)); (yyval.node) = embedded((yyvsp[(1) - (1)].sym));
} }
break; break;
case 232: case 232:
#line 1521 "go.y" #line 1523 "go.y"
{ {
(yyval.node) = nod(ODCLFIELD, (yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node)); (yyval.node) = nod(ODCLFIELD, (yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node));
ifacedcl((yyval.node)); ifacedcl((yyval.node));
...@@ -4032,14 +4034,14 @@ yyreduce: ...@@ -4032,14 +4034,14 @@ yyreduce:
break; break;
case 233: case 233:
#line 1526 "go.y" #line 1528 "go.y"
{ {
(yyval.node) = nod(ODCLFIELD, N, oldname((yyvsp[(1) - (1)].sym))); (yyval.node) = nod(ODCLFIELD, N, oldname((yyvsp[(1) - (1)].sym)));
} }
break; break;
case 234: case 234:
#line 1530 "go.y" #line 1532 "go.y"
{ {
(yyval.node) = nod(ODCLFIELD, N, oldname((yyvsp[(2) - (3)].sym))); (yyval.node) = nod(ODCLFIELD, N, oldname((yyvsp[(2) - (3)].sym)));
yyerror("cannot parenthesize embedded type"); yyerror("cannot parenthesize embedded type");
...@@ -4047,7 +4049,7 @@ yyreduce: ...@@ -4047,7 +4049,7 @@ yyreduce:
break; break;
case 235: case 235:
#line 1537 "go.y" #line 1539 "go.y"
{ {
// without func keyword // without func keyword
(yyvsp[(2) - (4)].list) = checkarglist((yyvsp[(2) - (4)].list), 1); (yyvsp[(2) - (4)].list) = checkarglist((yyvsp[(2) - (4)].list), 1);
...@@ -4058,7 +4060,7 @@ yyreduce: ...@@ -4058,7 +4060,7 @@ yyreduce:
break; break;
case 237: case 237:
#line 1551 "go.y" #line 1553 "go.y"
{ {
(yyval.node) = nod(ONONAME, N, N); (yyval.node) = nod(ONONAME, N, N);
(yyval.node)->sym = (yyvsp[(1) - (2)].sym); (yyval.node)->sym = (yyvsp[(1) - (2)].sym);
...@@ -4067,7 +4069,7 @@ yyreduce: ...@@ -4067,7 +4069,7 @@ yyreduce:
break; break;
case 238: case 238:
#line 1557 "go.y" #line 1559 "go.y"
{ {
(yyval.node) = nod(ONONAME, N, N); (yyval.node) = nod(ONONAME, N, N);
(yyval.node)->sym = (yyvsp[(1) - (2)].sym); (yyval.node)->sym = (yyvsp[(1) - (2)].sym);
...@@ -4076,56 +4078,56 @@ yyreduce: ...@@ -4076,56 +4078,56 @@ yyreduce:
break; break;
case 240: case 240:
#line 1566 "go.y" #line 1568 "go.y"
{ {
(yyval.list) = list1((yyvsp[(1) - (1)].node)); (yyval.list) = list1((yyvsp[(1) - (1)].node));
} }
break; break;
case 241: case 241:
#line 1570 "go.y" #line 1572 "go.y"
{ {
(yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node));
} }
break; break;
case 242: case 242:
#line 1575 "go.y" #line 1577 "go.y"
{ {
(yyval.list) = nil; (yyval.list) = nil;
} }
break; break;
case 243: case 243:
#line 1579 "go.y" #line 1581 "go.y"
{ {
(yyval.list) = (yyvsp[(1) - (2)].list); (yyval.list) = (yyvsp[(1) - (2)].list);
} }
break; break;
case 244: case 244:
#line 1587 "go.y" #line 1589 "go.y"
{ {
(yyval.node) = N; (yyval.node) = N;
} }
break; break;
case 246: case 246:
#line 1592 "go.y" #line 1594 "go.y"
{ {
(yyval.node) = liststmt((yyvsp[(1) - (1)].list)); (yyval.node) = liststmt((yyvsp[(1) - (1)].list));
} }
break; break;
case 248: case 248:
#line 1597 "go.y" #line 1599 "go.y"
{ {
(yyval.node) = N; (yyval.node) = N;
} }
break; break;
case 254: case 254:
#line 1608 "go.y" #line 1610 "go.y"
{ {
(yyvsp[(1) - (2)].node) = nod(OLABEL, (yyvsp[(1) - (2)].node), N); (yyvsp[(1) - (2)].node) = nod(OLABEL, (yyvsp[(1) - (2)].node), N);
(yyvsp[(1) - (2)].node)->sym = dclstack; // context, for goto restrictions (yyvsp[(1) - (2)].node)->sym = dclstack; // context, for goto restrictions
...@@ -4133,7 +4135,7 @@ yyreduce: ...@@ -4133,7 +4135,7 @@ yyreduce:
break; break;
case 255: case 255:
#line 1613 "go.y" #line 1615 "go.y"
{ {
NodeList *l; NodeList *l;
...@@ -4146,7 +4148,7 @@ yyreduce: ...@@ -4146,7 +4148,7 @@ yyreduce:
break; break;
case 256: case 256:
#line 1623 "go.y" #line 1625 "go.y"
{ {
// will be converted to OFALL // will be converted to OFALL
(yyval.node) = nod(OXFALL, N, N); (yyval.node) = nod(OXFALL, N, N);
...@@ -4154,35 +4156,35 @@ yyreduce: ...@@ -4154,35 +4156,35 @@ yyreduce:
break; break;
case 257: case 257:
#line 1628 "go.y" #line 1630 "go.y"
{ {
(yyval.node) = nod(OBREAK, (yyvsp[(2) - (2)].node), N); (yyval.node) = nod(OBREAK, (yyvsp[(2) - (2)].node), N);
} }
break; break;
case 258: case 258:
#line 1632 "go.y" #line 1634 "go.y"
{ {
(yyval.node) = nod(OCONTINUE, (yyvsp[(2) - (2)].node), N); (yyval.node) = nod(OCONTINUE, (yyvsp[(2) - (2)].node), N);
} }
break; break;
case 259: case 259:
#line 1636 "go.y" #line 1638 "go.y"
{ {
(yyval.node) = nod(OPROC, (yyvsp[(2) - (2)].node), N); (yyval.node) = nod(OPROC, (yyvsp[(2) - (2)].node), N);
} }
break; break;
case 260: case 260:
#line 1640 "go.y" #line 1642 "go.y"
{ {
(yyval.node) = nod(ODEFER, (yyvsp[(2) - (2)].node), N); (yyval.node) = nod(ODEFER, (yyvsp[(2) - (2)].node), N);
} }
break; break;
case 261: case 261:
#line 1644 "go.y" #line 1646 "go.y"
{ {
(yyval.node) = nod(OGOTO, (yyvsp[(2) - (2)].node), N); (yyval.node) = nod(OGOTO, (yyvsp[(2) - (2)].node), N);
(yyval.node)->sym = dclstack; // context, for goto restrictions (yyval.node)->sym = dclstack; // context, for goto restrictions
...@@ -4190,7 +4192,7 @@ yyreduce: ...@@ -4190,7 +4192,7 @@ yyreduce:
break; break;
case 262: case 262:
#line 1649 "go.y" #line 1651 "go.y"
{ {
(yyval.node) = nod(ORETURN, N, N); (yyval.node) = nod(ORETURN, N, N);
(yyval.node)->list = (yyvsp[(2) - (2)].list); (yyval.node)->list = (yyvsp[(2) - (2)].list);
...@@ -4210,7 +4212,7 @@ yyreduce: ...@@ -4210,7 +4212,7 @@ yyreduce:
break; break;
case 263: case 263:
#line 1668 "go.y" #line 1670 "go.y"
{ {
(yyval.list) = nil; (yyval.list) = nil;
if((yyvsp[(1) - (1)].node) != N) if((yyvsp[(1) - (1)].node) != N)
...@@ -4219,7 +4221,7 @@ yyreduce: ...@@ -4219,7 +4221,7 @@ yyreduce:
break; break;
case 264: case 264:
#line 1674 "go.y" #line 1676 "go.y"
{ {
(yyval.list) = (yyvsp[(1) - (3)].list); (yyval.list) = (yyvsp[(1) - (3)].list);
if((yyvsp[(3) - (3)].node) != N) if((yyvsp[(3) - (3)].node) != N)
...@@ -4228,192 +4230,194 @@ yyreduce: ...@@ -4228,192 +4230,194 @@ yyreduce:
break; break;
case 265: case 265:
#line 1682 "go.y" #line 1684 "go.y"
{ {
(yyval.list) = list1((yyvsp[(1) - (1)].node)); (yyval.list) = list1((yyvsp[(1) - (1)].node));
} }
break; break;
case 266: case 266:
#line 1686 "go.y" #line 1688 "go.y"
{ {
(yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node));
} }
break; break;
case 267: case 267:
#line 1692 "go.y" #line 1694 "go.y"
{ {
(yyval.list) = list1((yyvsp[(1) - (1)].node)); (yyval.list) = list1((yyvsp[(1) - (1)].node));
} }
break; break;
case 268: case 268:
#line 1696 "go.y" #line 1698 "go.y"
{ {
(yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node));
} }
break; break;
case 269: case 269:
#line 1702 "go.y" #line 1704 "go.y"
{ {
(yyval.list) = list1((yyvsp[(1) - (1)].node)); (yyval.list) = list1((yyvsp[(1) - (1)].node));
} }
break; break;
case 270: case 270:
#line 1706 "go.y" #line 1708 "go.y"
{ {
(yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node));
} }
break; break;
case 271: case 271:
#line 1712 "go.y" #line 1714 "go.y"
{ {
(yyval.list) = list1((yyvsp[(1) - (1)].node)); (yyval.list) = list1((yyvsp[(1) - (1)].node));
} }
break; break;
case 272: case 272:
#line 1716 "go.y" #line 1718 "go.y"
{ {
(yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node));
} }
break; break;
case 273: case 273:
#line 1725 "go.y" #line 1727 "go.y"
{ {
(yyval.list) = list1((yyvsp[(1) - (1)].node)); (yyval.list) = list1((yyvsp[(1) - (1)].node));
} }
break; break;
case 274: case 274:
#line 1729 "go.y" #line 1731 "go.y"
{ {
(yyval.list) = list1((yyvsp[(1) - (1)].node)); (yyval.list) = list1((yyvsp[(1) - (1)].node));
} }
break; break;
case 275: case 275:
#line 1733 "go.y" #line 1735 "go.y"
{ {
(yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node));
} }
break; break;
case 276: case 276:
#line 1737 "go.y" #line 1739 "go.y"
{ {
(yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node));
} }
break; break;
case 277: case 277:
#line 1742 "go.y" #line 1744 "go.y"
{ {
(yyval.list) = nil; (yyval.list) = nil;
} }
break; break;
case 278: case 278:
#line 1746 "go.y" #line 1748 "go.y"
{ {
(yyval.list) = (yyvsp[(1) - (2)].list); (yyval.list) = (yyvsp[(1) - (2)].list);
} }
break; break;
case 283: case 283:
#line 1760 "go.y" #line 1762 "go.y"
{ {
(yyval.node) = N; (yyval.node) = N;
} }
break; break;
case 285: case 285:
#line 1766 "go.y" #line 1768 "go.y"
{ {
(yyval.list) = nil; (yyval.list) = nil;
} }
break; break;
case 287: case 287:
#line 1772 "go.y" #line 1774 "go.y"
{ {
(yyval.node) = N; (yyval.node) = N;
} }
break; break;
case 289: case 289:
#line 1778 "go.y" #line 1780 "go.y"
{ {
(yyval.list) = nil; (yyval.list) = nil;
} }
break; break;
case 291: case 291:
#line 1784 "go.y" #line 1786 "go.y"
{ {
(yyval.list) = nil; (yyval.list) = nil;
} }
break; break;
case 293: case 293:
#line 1790 "go.y" #line 1792 "go.y"
{ {
(yyval.list) = nil; (yyval.list) = nil;
} }
break; break;
case 295: case 295:
#line 1796 "go.y" #line 1798 "go.y"
{ {
(yyval.val).ctype = CTxxx; (yyval.val).ctype = CTxxx;
} }
break; break;
case 297: case 297:
#line 1806 "go.y" #line 1808 "go.y"
{ {
importimport((yyvsp[(2) - (4)].sym), (yyvsp[(3) - (4)].val).u.sval); importimport((yyvsp[(2) - (4)].sym), (yyvsp[(3) - (4)].val).u.sval);
} }
break; break;
case 298: case 298:
#line 1810 "go.y" #line 1812 "go.y"
{ {
importvar((yyvsp[(2) - (4)].sym), (yyvsp[(3) - (4)].type)); importvar((yyvsp[(2) - (4)].sym), (yyvsp[(3) - (4)].type));
} }
break; break;
case 299: case 299:
#line 1814 "go.y" #line 1816 "go.y"
{ {
importconst((yyvsp[(2) - (5)].sym), types[TIDEAL], (yyvsp[(4) - (5)].node)); importconst((yyvsp[(2) - (5)].sym), types[TIDEAL], (yyvsp[(4) - (5)].node));
} }
break; break;
case 300: case 300:
#line 1818 "go.y" #line 1820 "go.y"
{ {
importconst((yyvsp[(2) - (6)].sym), (yyvsp[(3) - (6)].type), (yyvsp[(5) - (6)].node)); importconst((yyvsp[(2) - (6)].sym), (yyvsp[(3) - (6)].type), (yyvsp[(5) - (6)].node));
} }
break; break;
case 301: case 301:
#line 1822 "go.y" #line 1824 "go.y"
{ {
importtype((yyvsp[(2) - (4)].type), (yyvsp[(3) - (4)].type)); importtype((yyvsp[(2) - (4)].type), (yyvsp[(3) - (4)].type));
} }
break; break;
case 302: case 302:
#line 1826 "go.y" #line 1828 "go.y"
{ {
if((yyvsp[(2) - (4)].node) == N) if((yyvsp[(2) - (4)].node) == N) {
dclcontext = PEXTERN; // since we skip the funcbody below
break; break;
}
(yyvsp[(2) - (4)].node)->inl = (yyvsp[(3) - (4)].list); (yyvsp[(2) - (4)].node)->inl = (yyvsp[(3) - (4)].list);
...@@ -4422,14 +4426,14 @@ yyreduce: ...@@ -4422,14 +4426,14 @@ yyreduce:
if(debug['E']) { if(debug['E']) {
print("import [%Z] func %lN \n", importpkg->path, (yyvsp[(2) - (4)].node)); print("import [%Z] func %lN \n", importpkg->path, (yyvsp[(2) - (4)].node));
if(debug['l'] > 2 && (yyvsp[(2) - (4)].node)->inl) if(debug['m'] > 2 && (yyvsp[(2) - (4)].node)->inl)
print("inl body:%+H\n", (yyvsp[(2) - (4)].node)->inl); print("inl body:%+H\n", (yyvsp[(2) - (4)].node)->inl);
} }
} }
break; break;
case 303: case 303:
#line 1844 "go.y" #line 1848 "go.y"
{ {
(yyval.sym) = (yyvsp[(1) - (1)].sym); (yyval.sym) = (yyvsp[(1) - (1)].sym);
structpkg = (yyval.sym)->pkg; structpkg = (yyval.sym)->pkg;
...@@ -4437,7 +4441,7 @@ yyreduce: ...@@ -4437,7 +4441,7 @@ yyreduce:
break; break;
case 304: case 304:
#line 1851 "go.y" #line 1855 "go.y"
{ {
(yyval.type) = pkgtype((yyvsp[(1) - (1)].sym)); (yyval.type) = pkgtype((yyvsp[(1) - (1)].sym));
importsym((yyvsp[(1) - (1)].sym), OTYPE); importsym((yyvsp[(1) - (1)].sym), OTYPE);
...@@ -4445,14 +4449,14 @@ yyreduce: ...@@ -4445,14 +4449,14 @@ yyreduce:
break; break;
case 310: case 310:
#line 1871 "go.y" #line 1875 "go.y"
{ {
(yyval.type) = pkgtype((yyvsp[(1) - (1)].sym)); (yyval.type) = pkgtype((yyvsp[(1) - (1)].sym));
} }
break; break;
case 311: case 311:
#line 1875 "go.y" #line 1879 "go.y"
{ {
// predefined name like uint8 // predefined name like uint8
(yyvsp[(1) - (1)].sym) = pkglookup((yyvsp[(1) - (1)].sym)->name, builtinpkg); (yyvsp[(1) - (1)].sym) = pkglookup((yyvsp[(1) - (1)].sym)->name, builtinpkg);
...@@ -4465,49 +4469,49 @@ yyreduce: ...@@ -4465,49 +4469,49 @@ yyreduce:
break; break;
case 312: case 312:
#line 1885 "go.y" #line 1889 "go.y"
{ {
(yyval.type) = aindex(N, (yyvsp[(3) - (3)].type)); (yyval.type) = aindex(N, (yyvsp[(3) - (3)].type));
} }
break; break;
case 313: case 313:
#line 1889 "go.y" #line 1893 "go.y"
{ {
(yyval.type) = aindex(nodlit((yyvsp[(2) - (4)].val)), (yyvsp[(4) - (4)].type)); (yyval.type) = aindex(nodlit((yyvsp[(2) - (4)].val)), (yyvsp[(4) - (4)].type));
} }
break; break;
case 314: case 314:
#line 1893 "go.y" #line 1897 "go.y"
{ {
(yyval.type) = maptype((yyvsp[(3) - (5)].type), (yyvsp[(5) - (5)].type)); (yyval.type) = maptype((yyvsp[(3) - (5)].type), (yyvsp[(5) - (5)].type));
} }
break; break;
case 315: case 315:
#line 1897 "go.y" #line 1901 "go.y"
{ {
(yyval.type) = tostruct((yyvsp[(3) - (4)].list)); (yyval.type) = tostruct((yyvsp[(3) - (4)].list));
} }
break; break;
case 316: case 316:
#line 1901 "go.y" #line 1905 "go.y"
{ {
(yyval.type) = tointerface((yyvsp[(3) - (4)].list)); (yyval.type) = tointerface((yyvsp[(3) - (4)].list));
} }
break; break;
case 317: case 317:
#line 1905 "go.y" #line 1909 "go.y"
{ {
(yyval.type) = ptrto((yyvsp[(2) - (2)].type)); (yyval.type) = ptrto((yyvsp[(2) - (2)].type));
} }
break; break;
case 318: case 318:
#line 1909 "go.y" #line 1913 "go.y"
{ {
(yyval.type) = typ(TCHAN); (yyval.type) = typ(TCHAN);
(yyval.type)->type = (yyvsp[(2) - (2)].type); (yyval.type)->type = (yyvsp[(2) - (2)].type);
...@@ -4516,7 +4520,7 @@ yyreduce: ...@@ -4516,7 +4520,7 @@ yyreduce:
break; break;
case 319: case 319:
#line 1915 "go.y" #line 1919 "go.y"
{ {
(yyval.type) = typ(TCHAN); (yyval.type) = typ(TCHAN);
(yyval.type)->type = (yyvsp[(3) - (4)].type); (yyval.type)->type = (yyvsp[(3) - (4)].type);
...@@ -4525,7 +4529,7 @@ yyreduce: ...@@ -4525,7 +4529,7 @@ yyreduce:
break; break;
case 320: case 320:
#line 1921 "go.y" #line 1925 "go.y"
{ {
(yyval.type) = typ(TCHAN); (yyval.type) = typ(TCHAN);
(yyval.type)->type = (yyvsp[(3) - (3)].type); (yyval.type)->type = (yyvsp[(3) - (3)].type);
...@@ -4534,7 +4538,7 @@ yyreduce: ...@@ -4534,7 +4538,7 @@ yyreduce:
break; break;
case 321: case 321:
#line 1929 "go.y" #line 1933 "go.y"
{ {
(yyval.type) = typ(TCHAN); (yyval.type) = typ(TCHAN);
(yyval.type)->type = (yyvsp[(3) - (3)].type); (yyval.type)->type = (yyvsp[(3) - (3)].type);
...@@ -4543,14 +4547,14 @@ yyreduce: ...@@ -4543,14 +4547,14 @@ yyreduce:
break; break;
case 322: case 322:
#line 1937 "go.y" #line 1941 "go.y"
{ {
(yyval.type) = functype(nil, (yyvsp[(3) - (5)].list), (yyvsp[(5) - (5)].list)); (yyval.type) = functype(nil, (yyvsp[(3) - (5)].list), (yyvsp[(5) - (5)].list));
} }
break; break;
case 323: case 323:
#line 1943 "go.y" #line 1947 "go.y"
{ {
(yyval.node) = nod(ODCLFIELD, N, typenod((yyvsp[(2) - (3)].type))); (yyval.node) = nod(ODCLFIELD, N, typenod((yyvsp[(2) - (3)].type)));
if((yyvsp[(1) - (3)].sym)) if((yyvsp[(1) - (3)].sym))
...@@ -4560,7 +4564,7 @@ yyreduce: ...@@ -4560,7 +4564,7 @@ yyreduce:
break; break;
case 324: case 324:
#line 1950 "go.y" #line 1954 "go.y"
{ {
Type *t; Type *t;
...@@ -4577,7 +4581,7 @@ yyreduce: ...@@ -4577,7 +4581,7 @@ yyreduce:
break; break;
case 325: case 325:
#line 1966 "go.y" #line 1970 "go.y"
{ {
Sym *s; Sym *s;
...@@ -4596,49 +4600,49 @@ yyreduce: ...@@ -4596,49 +4600,49 @@ yyreduce:
break; break;
case 326: case 326:
#line 1984 "go.y" #line 1988 "go.y"
{ {
(yyval.node) = nod(ODCLFIELD, newname((yyvsp[(1) - (5)].sym)), typenod(functype(fakethis(), (yyvsp[(3) - (5)].list), (yyvsp[(5) - (5)].list)))); (yyval.node) = nod(ODCLFIELD, newname((yyvsp[(1) - (5)].sym)), typenod(functype(fakethis(), (yyvsp[(3) - (5)].list), (yyvsp[(5) - (5)].list))));
} }
break; break;
case 327: case 327:
#line 1988 "go.y" #line 1992 "go.y"
{ {
(yyval.node) = nod(ODCLFIELD, N, typenod((yyvsp[(1) - (1)].type))); (yyval.node) = nod(ODCLFIELD, N, typenod((yyvsp[(1) - (1)].type)));
} }
break; break;
case 328: case 328:
#line 1993 "go.y" #line 1997 "go.y"
{ {
(yyval.list) = nil; (yyval.list) = nil;
} }
break; break;
case 330: case 330:
#line 2000 "go.y" #line 2004 "go.y"
{ {
(yyval.list) = (yyvsp[(2) - (3)].list); (yyval.list) = (yyvsp[(2) - (3)].list);
} }
break; break;
case 331: case 331:
#line 2004 "go.y" #line 2008 "go.y"
{ {
(yyval.list) = list1(nod(ODCLFIELD, N, typenod((yyvsp[(1) - (1)].type)))); (yyval.list) = list1(nod(ODCLFIELD, N, typenod((yyvsp[(1) - (1)].type))));
} }
break; break;
case 332: case 332:
#line 2014 "go.y" #line 2018 "go.y"
{ {
(yyval.node) = nodlit((yyvsp[(1) - (1)].val)); (yyval.node) = nodlit((yyvsp[(1) - (1)].val));
} }
break; break;
case 333: case 333:
#line 2018 "go.y" #line 2022 "go.y"
{ {
(yyval.node) = nodlit((yyvsp[(2) - (2)].val)); (yyval.node) = nodlit((yyvsp[(2) - (2)].val));
switch((yyval.node)->val.ctype){ switch((yyval.node)->val.ctype){
...@@ -4656,7 +4660,7 @@ yyreduce: ...@@ -4656,7 +4660,7 @@ yyreduce:
break; break;
case 334: case 334:
#line 2033 "go.y" #line 2037 "go.y"
{ {
(yyval.node) = oldname(pkglookup((yyvsp[(1) - (1)].sym)->name, builtinpkg)); (yyval.node) = oldname(pkglookup((yyvsp[(1) - (1)].sym)->name, builtinpkg));
if((yyval.node)->op != OLITERAL) if((yyval.node)->op != OLITERAL)
...@@ -4665,7 +4669,7 @@ yyreduce: ...@@ -4665,7 +4669,7 @@ yyreduce:
break; break;
case 336: case 336:
#line 2042 "go.y" #line 2046 "go.y"
{ {
if((yyvsp[(2) - (5)].node)->val.ctype == CTRUNE && (yyvsp[(4) - (5)].node)->val.ctype == CTINT) { if((yyvsp[(2) - (5)].node)->val.ctype == CTRUNE && (yyvsp[(4) - (5)].node)->val.ctype == CTINT) {
(yyval.node) = (yyvsp[(2) - (5)].node); (yyval.node) = (yyvsp[(2) - (5)].node);
...@@ -4679,42 +4683,42 @@ yyreduce: ...@@ -4679,42 +4683,42 @@ yyreduce:
break; break;
case 339: case 339:
#line 2058 "go.y" #line 2062 "go.y"
{ {
(yyval.list) = list1((yyvsp[(1) - (1)].node)); (yyval.list) = list1((yyvsp[(1) - (1)].node));
} }
break; break;
case 340: case 340:
#line 2062 "go.y" #line 2066 "go.y"
{ {
(yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node));
} }
break; break;
case 341: case 341:
#line 2068 "go.y" #line 2072 "go.y"
{ {
(yyval.list) = list1((yyvsp[(1) - (1)].node)); (yyval.list) = list1((yyvsp[(1) - (1)].node));
} }
break; break;
case 342: case 342:
#line 2072 "go.y" #line 2076 "go.y"
{ {
(yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node));
} }
break; break;
case 343: case 343:
#line 2078 "go.y" #line 2082 "go.y"
{ {
(yyval.list) = list1((yyvsp[(1) - (1)].node)); (yyval.list) = list1((yyvsp[(1) - (1)].node));
} }
break; break;
case 344: case 344:
#line 2082 "go.y" #line 2086 "go.y"
{ {
(yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); (yyval.list) = list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node));
} }
...@@ -4722,7 +4726,7 @@ yyreduce: ...@@ -4722,7 +4726,7 @@ yyreduce:
/* Line 1267 of yacc.c. */ /* Line 1267 of yacc.c. */
#line 4727 "y.tab.c" #line 4731 "y.tab.c"
default: break; default: break;
} }
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
...@@ -4936,7 +4940,7 @@ yyreturn: ...@@ -4936,7 +4940,7 @@ yyreturn:
} }
#line 2086 "go.y" #line 2090 "go.y"
static void static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment