mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
cmd/gc: fix inlining of unnamed structs with embedded fields.
Update #5910. R=golang-dev, daniel.morsing, rsc CC=golang-dev https://golang.org/cl/11373044
This commit is contained in:
parent
8a0779f9b9
commit
49da9a8e44
|
@ -1541,8 +1541,8 @@ structdcl:
|
||||||
|
|
||||||
Node *n;
|
Node *n;
|
||||||
l = $1;
|
l = $1;
|
||||||
if(l != nil && l->next == nil && l->n == nil) {
|
if(l == nil) {
|
||||||
// ? symbol, during import
|
// ? symbol, during import (list1(N) == nil)
|
||||||
n = $2;
|
n = $2;
|
||||||
if(n->op == OIND)
|
if(n->op == OIND)
|
||||||
n = n->left;
|
n = n->left;
|
||||||
|
|
1260
src/cmd/gc/y.tab.c
1260
src/cmd/gc/y.tab.c
File diff suppressed because it is too large
Load diff
|
@ -1,24 +1,21 @@
|
||||||
/* A Bison parser, made by GNU Bison 2.3. */
|
/* A Bison parser, made by GNU Bison 2.5. */
|
||||||
|
|
||||||
/* Skeleton interface for Bison's Yacc-like parsers in C
|
/* Bison interface for Yacc-like parsers in C
|
||||||
|
|
||||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
|
||||||
Free Software Foundation, Inc.
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2, or (at your option)
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
Boston, MA 02110-1301, USA. */
|
|
||||||
|
|
||||||
/* As a special exception, you may create a larger work that contains
|
/* As a special exception, you may create a larger work that contains
|
||||||
part or all of the Bison parser skeleton and distribute that work
|
part or all of the Bison parser skeleton and distribute that work
|
||||||
|
@ -29,10 +26,11 @@
|
||||||
special exception, which will cause the skeleton and the resulting
|
special exception, which will cause the skeleton and the resulting
|
||||||
Bison output files to be licensed under the GNU General Public
|
Bison output files to be licensed under the GNU General Public
|
||||||
License without this special exception.
|
License without this special exception.
|
||||||
|
|
||||||
This special exception was added by the Free Software Foundation in
|
This special exception was added by the Free Software Foundation in
|
||||||
version 2.2 of Bison. */
|
version 2.2 of Bison. */
|
||||||
|
|
||||||
|
|
||||||
/* Tokens. */
|
/* Tokens. */
|
||||||
#ifndef YYTOKENTYPE
|
#ifndef YYTOKENTYPE
|
||||||
# define YYTOKENTYPE
|
# define YYTOKENTYPE
|
||||||
|
@ -146,22 +144,28 @@
|
||||||
|
|
||||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||||
typedef union YYSTYPE
|
typedef union YYSTYPE
|
||||||
#line 30 "go.y"
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/* Line 2068 of yacc.c */
|
||||||
|
#line 30 "go.y"
|
||||||
|
|
||||||
Node* node;
|
Node* node;
|
||||||
NodeList* list;
|
NodeList* list;
|
||||||
Type* type;
|
Type* type;
|
||||||
Sym* sym;
|
Sym* sym;
|
||||||
struct Val val;
|
struct Val val;
|
||||||
int i;
|
int i;
|
||||||
}
|
|
||||||
/* Line 1529 of yacc.c. */
|
|
||||||
#line 160 "y.tab.h"
|
|
||||||
YYSTYPE;
|
/* Line 2068 of yacc.c */
|
||||||
|
#line 163 "y.tab.h"
|
||||||
|
} YYSTYPE;
|
||||||
|
# define YYSTYPE_IS_TRIVIAL 1
|
||||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||||
# define YYSTYPE_IS_DECLARED 1
|
# define YYSTYPE_IS_DECLARED 1
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern YYSTYPE yylval;
|
extern YYSTYPE yylval;
|
||||||
|
|
||||||
|
|
||||||
|
|
17
test/fixedbugs/issue5910.dir/a.go
Normal file
17
test/fixedbugs/issue5910.dir/a.go
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
package a
|
||||||
|
|
||||||
|
type Package struct {
|
||||||
|
name string
|
||||||
|
}
|
||||||
|
|
||||||
|
type Future struct {
|
||||||
|
result chan struct {
|
||||||
|
*Package
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *Future) Result() *Package {
|
||||||
|
result := <-t.result
|
||||||
|
t.result <- result
|
||||||
|
return result.Package
|
||||||
|
}
|
8
test/fixedbugs/issue5910.dir/main.go
Normal file
8
test/fixedbugs/issue5910.dir/main.go
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "a"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
f := new(a.Future)
|
||||||
|
f.Result()
|
||||||
|
}
|
10
test/fixedbugs/issue5910.go
Normal file
10
test/fixedbugs/issue5910.go
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
// compiledir
|
||||||
|
|
||||||
|
// Copyright 2013 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Issue 5910: parsing of unnamed struct types
|
||||||
|
// in inlined bodies was broken.
|
||||||
|
|
||||||
|
package ignored
|
Loading…
Reference in a new issue