Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
5fc3771b
Commit
5fc3771b
authored
Nov 11, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: remove m[k] = x, false
R=ken2 CC=golang-dev
https://golang.org/cl/5376076
parent
90c50700
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
5 additions
and
71 deletions
+5
-71
src/cmd/gc/esc.c
src/cmd/gc/esc.c
+0
-1
src/cmd/gc/fmt.c
src/cmd/gc/fmt.c
+0
-2
src/cmd/gc/go.h
src/cmd/gc/go.h
+1
-1
src/cmd/gc/typecheck.c
src/cmd/gc/typecheck.c
+2
-11
src/cmd/gc/walk.c
src/cmd/gc/walk.c
+0
-12
src/pkg/runtime/hashmap.c
src/pkg/runtime/hashmap.c
+0
-28
test/fixedbugs/bug220.go
test/fixedbugs/bug220.go
+0
-14
test/fixedbugs/bug242.go
test/fixedbugs/bug242.go
+2
-1
test/named1.go
test/named1.go
+0
-1
No files found.
src/cmd/gc/esc.c
View file @
5fc3771b
...
...
@@ -222,7 +222,6 @@ esc(Node *n)
case
OAS2RECV
:
// v, ok = <-ch
case
OAS2MAPR
:
// v, ok = m[k]
case
OAS2DOTTYPE
:
// v, ok = x.(type)
case
OAS2MAPW
:
// m[k] = x, ok
escassign
(
n
->
list
->
n
,
n
->
rlist
->
n
);
break
;
...
...
src/cmd/gc/fmt.c
View file @
5fc3771b
...
...
@@ -802,7 +802,6 @@ stmtfmt(Fmt *f, Node *n)
case
OAS2DOTTYPE
:
case
OAS2FUNC
:
case
OAS2MAPR
:
case
OAS2MAPW
:
case
OAS2RECV
:
fmtprint
(
f
,
"%,H = %,H"
,
n
->
list
,
n
->
rlist
);
break
;
...
...
@@ -981,7 +980,6 @@ static int opprec[] = {
[
OAS2DOTTYPE
]
=
-
1
,
[
OAS2FUNC
]
=
-
1
,
[
OAS2MAPR
]
=
-
1
,
[
OAS2MAPW
]
=
-
1
,
[
OAS2RECV
]
=
-
1
,
[
OASOP
]
=
-
1
,
[
OBREAK
]
=
-
1
,
...
...
src/cmd/gc/go.h
View file @
5fc3771b
...
...
@@ -425,7 +425,7 @@ enum
OAPPEND
,
OARRAYBYTESTR
,
OARRAYRUNESTR
,
OSTRARRAYBYTE
,
OSTRARRAYRUNE
,
OAS
,
OAS2
,
OAS2
MAPW
,
OAS2
FUNC
,
OAS2RECV
,
OAS2MAPR
,
OAS2DOTTYPE
,
OAS
,
OAS2
,
OAS2FUNC
,
OAS2RECV
,
OAS2MAPR
,
OAS2DOTTYPE
,
OASOP
,
OBAD
,
OCALL
,
OCALLFUNC
,
OCALLMETH
,
OCALLINTER
,
...
...
src/cmd/gc/typecheck.c
View file @
5fc3771b
...
...
@@ -2334,7 +2334,7 @@ typecheckas2(Node *n)
{
int
cl
,
cr
;
NodeList
*
ll
,
*
lr
;
Node
*
l
,
*
r
,
*
rr
;
Node
*
l
,
*
r
;
Iter
s
;
Type
*
t
;
...
...
@@ -2373,16 +2373,7 @@ typecheckas2(Node *n)
if
(
cl
==
1
&&
cr
==
2
&&
l
->
op
==
OINDEXMAP
)
{
if
(
l
->
type
==
T
)
goto
out
;
n
->
op
=
OAS2MAPW
;
n
->
rlist
->
n
=
assignconv
(
r
,
l
->
type
,
"assignment"
);
rr
=
n
->
rlist
->
next
->
n
;
n
->
rlist
->
next
->
n
=
assignconv
(
rr
,
types
[
TBOOL
],
"assignment"
);
if
(
isconst
(
rr
,
CTBOOL
)
&&
!
rr
->
val
.
u
.
bval
)
{
n
->
op
=
ODELETE
;
n
->
list
=
list
(
list1
(
l
->
left
),
l
->
right
);
n
->
right
=
n
->
rlist
->
n
;
n
->
rlist
=
nil
;
}
yyerror
(
"assignment count mismatch: %d = %d (use delete)"
,
cl
,
cr
);
goto
out
;
}
...
...
src/cmd/gc/walk.c
View file @
5fc3771b
...
...
@@ -183,7 +183,6 @@ walkstmt(Node **np)
case
OAS2DOTTYPE
:
case
OAS2RECV
:
case
OAS2FUNC
:
case
OAS2MAPW
:
case
OAS2MAPR
:
case
OCLOSE
:
case
OCOPY
:
...
...
@@ -644,17 +643,6 @@ walkexpr(Node **np, NodeList **init)
n
=
mkcall1
(
mapfndel
(
"mapdelete"
,
t
),
t
->
down
,
init
,
typename
(
t
),
l
,
r
);
goto
ret
;
case
OAS2MAPW
:
// map[] = a,b - mapassign2
// a,b = m[i];
*
init
=
concat
(
*
init
,
n
->
ninit
);
n
->
ninit
=
nil
;
walkexprlistsafe
(
n
->
list
,
init
);
l
=
n
->
list
->
n
;
t
=
l
->
left
->
type
;
n
=
mkcall1
(
mapfn
(
"mapassign2"
,
t
),
T
,
init
,
typename
(
t
),
l
->
left
,
l
->
right
,
n
->
rlist
->
n
,
n
->
rlist
->
next
->
n
);
goto
ret
;
case
OAS2DOTTYPE
:
// a,b = i.(T)
*
init
=
concat
(
*
init
,
n
->
ninit
);
...
...
src/pkg/runtime/hashmap.c
View file @
5fc3771b
...
...
@@ -1000,34 +1000,6 @@ runtime·mapassign1(MapType *t, Hmap *h, ...)
runtime
·
mapassign
(
t
,
h
,
ak
,
av
);
}
// mapassign2(mapType *type, hmap *map[any]any, key any, val any, pres bool);
#pragma textflag 7
void
runtime
·
mapassign2
(
MapType
*
t
,
Hmap
*
h
,
...)
{
byte
*
ak
,
*
av
,
*
ap
;
if
(
h
==
nil
)
runtime
·
panicstring
(
"assignment to entry in nil map"
);
ak
=
(
byte
*
)
&
h
+
h
->
ko2
;
av
=
(
byte
*
)
&
h
+
h
->
vo2
;
ap
=
(
byte
*
)
&
h
+
h
->
po2
;
if
(
*
ap
==
false
)
av
=
nil
;
// delete
runtime
·
mapassign
(
t
,
h
,
ak
,
av
);
if
(
debug
)
{
runtime
·
prints
(
"mapassign2: map="
);
runtime
·
printpointer
(
h
);
runtime
·
prints
(
"; key="
);
h
->
keyalg
->
print
(
h
->
keysize
,
ak
);
runtime
·
prints
(
"
\n
"
);
}
}
// mapdelete(mapType *type, hmap *map[any]any, key any)
#pragma textflag 7
void
...
...
test/fixedbugs/bug220.go
deleted
100644 → 0
View file @
90c50700
// $G $D/$F.go || echo BUG: bug220
// Copyright 2009 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.
package
main
func
main
()
{
m
:=
make
(
map
[
int
]
map
[
uint
]
float64
)
m
[
0
]
=
make
(
map
[
uint
]
float64
),
false
// 6g used to reject this
m
[
1
]
=
nil
}
test/fixedbugs/bug242.go
View file @
5fc3771b
...
...
@@ -93,7 +93,8 @@ func main() {
m
[
13
]
=
'B'
// 13 14
m
[
gint
()]
=
gbyte
(),
false
delete
(
m
,
gint
())
gbyte
()
if
_
,
present
:=
m
[
13
];
present
{
println
(
"bad map removal"
)
panic
(
"fail"
)
...
...
test/named1.go
View file @
5fc3771b
...
...
@@ -41,7 +41,6 @@ func main() {
asBool
(
i
<
j
)
// ERROR "cannot use.*type bool.*as type Bool"
_
,
b
=
m
[
2
]
// ERROR "cannot .* bool.*type Bool"
m
[
2
]
=
1
,
b
// ERROR "cannot use.*type Bool.*as type bool"
var
inter
interface
{}
_
,
b
=
inter
.
(
Map
)
// ERROR "cannot .* bool.*type Bool"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment