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

Unified Diff: src/cmd/gc/reflect.c

Issue 4444049: code review 4444049: reflect: allow Slice of arrays (Closed)
Patch Set: diff -r 44d9b2c594a8 https://go.googlecode.com/hg/ Created 13 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/pkg/reflect/all_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cmd/gc/reflect.c
===================================================================
--- a/src/cmd/gc/reflect.c
+++ b/src/cmd/gc/reflect.c
@@ -690,7 +690,7 @@
int ot, xt, n, isddd, dupok;
Sym *s, *s1, *s2;
Sig *a, *m;
- Type *t1, *tbase;
+ Type *t1, *tbase, *t2;
if(isideal(t))
fatal("dtypesym %T", t);
@@ -727,15 +727,25 @@
break;
case TARRAY:
- // ../../pkg/runtime/type.go:/ArrayType
- s1 = dtypesym(t->type);
- ot = dcommontype(s, ot, t);
- xt = ot - 2*widthptr;
- ot = dsymptr(s, ot, s1, 0);
- if(t->bound < 0)
- ot = duintptr(s, ot, -1);
- else
+ if(t->bound >= 0) {
+ // ../../pkg/runtime/type.go:/ArrayType
+ s1 = dtypesym(t->type);
+ t2 = typ(TARRAY);
+ t2->type = t->type;
+ t2->bound = -1; // slice
+ s2 = dtypesym(t2);
+ ot = dcommontype(s, ot, t);
+ xt = ot - 2*widthptr;
+ ot = dsymptr(s, ot, s1, 0);
+ ot = dsymptr(s, ot, s2, 0);
ot = duintptr(s, ot, t->bound);
+ } else {
+ // ../../pkg/runtime/type.go:/SliceType
+ s1 = dtypesym(t->type);
+ ot = dcommontype(s, ot, t);
+ xt = ot - 2*widthptr;
+ ot = dsymptr(s, ot, s1, 0);
+ }
break;
case TCHAN:
« no previous file with comments | « no previous file | src/pkg/reflect/all_test.go » ('j') | no next file with comments »

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