http://codereview.appspot.com/3987045/diff/15001/src/cmd/cc/godefs.c File src/cmd/cc/godefs.c (right): http://codereview.appspot.com/3987045/diff/15001/src/cmd/cc/godefs.c#newcode89 src/cmd/cc/godefs.c:89: On 2011/01/25 17:11:13, lvd wrote: > On 2011/01/25 16:10:58, ...
14 years, 3 months ago
(2011-01-25 17:52:58 UTC)
#6
http://codereview.appspot.com/3987045/diff/15001/src/cmd/cc/godefs.c
File src/cmd/cc/godefs.c (right):
http://codereview.appspot.com/3987045/diff/15001/src/cmd/cc/godefs.c#newcode89
src/cmd/cc/godefs.c:89:
On 2011/01/25 17:11:13, lvd wrote:
> On 2011/01/25 16:10:58, rsc wrote:
> > if(upper)
> > return s;
> no i don't think so.
agree that that's not quite right.
what i was trying to do was make
sure that if you had a field named,
say, type, it would not be renamed
to _type and then uppercased to _type.
in that case you want to skip the _
processing and just format it as Type.
so maybe the real fix is
if(!upper) {
... current binary search
}
http://codereview.appspot.com/3987045/diff/25001/src/cmd/cc/godefs.c#newcode166
src/cmd/cc/godefs.c:166: case TUINT: Bprint(&outbuf, "uint"); break;
this is fine if you want to leave it this way
but it still seems like a table would be easier
to edit.
static char *gonames[] = {
[TINT] = "int",
[TUINT] = "uint",
...
}
default:
if(t->etype < nelem(gonames) && gonames[t->etype] != nil) {
Bprint(&outbuf, "%s", gonames[t->etype]);
return;
}
either way
On Tue, Jan 25, 2011 at 18:52, <rsc@golang.org> wrote: > > http://codereview.appspot.com/3987045/diff/15001/src/cmd/cc/godefs.c > File src/cmd/cc/godefs.c ...
14 years, 3 months ago
(2011-01-25 17:56:46 UTC)
#7
On Tue, Jan 25, 2011 at 18:52, <rsc@golang.org> wrote:
>
> http://codereview.appspot.com/3987045/diff/15001/src/cmd/cc/godefs.c
> File src/cmd/cc/godefs.c (right):
>
>
> http://codereview.appspot.com/3987045/diff/15001/src/cmd/cc/godefs.c#newcode89
> src/cmd/cc/godefs.c:89:
> On 2011/01/25 17:11:13, lvd wrote:
>
>> On 2011/01/25 16:10:58, rsc wrote:
>> > if(upper)
>> > return s;
>> no i don't think so.
>>
>
> agree that that's not quite right.
> what i was trying to do was make
> sure that if you had a field named,
> say, type, it would not be renamed
> to _type and then uppercased to _type.
> in that case you want to skip the _
> processing and just format it as Type.
> so maybe the real fix is
>
> if(!upper) {
> ... current binary search
> }
>
done
>
>
>
http://codereview.appspot.com/3987045/diff/25001/src/cmd/cc/godefs.c#newcode166
> src/cmd/cc/godefs.c:166: case TUINT: Bprint(&outbuf, "uint"); break;
> this is fine if you want to leave it this way
> but it still seems like a table would be easier
> to edit.
if i ever change it i'll make it a table.
>
>
> static char *gonames[] = {
> [TINT] = "int",
> [TUINT] = "uint",
> ...
> }
>
> default:
> if(t->etype < nelem(gonames) && gonames[t->etype] != nil) {
> Bprint(&outbuf, "%s", gonames[t->etype]);
> return;
> }
>
> either way
>
>
> http://codereview.appspot.com/3987045/
>
Issue 3987045: code review 3987045: cc: mode to generate go-code for types and variables.
(Closed)
Created 14 years, 3 months ago by lvd
Modified 14 years, 3 months ago
Reviewers:
Base URL:
Comments: 45