@@ -1242,19 +1242,19 @@ var (
1242
1242
1243
1243
type bmExargs = []interface {}
1244
1244
1245
- type builtinMethod struct {
1246
- name string
1247
- fn types.Object
1248
- eargs bmExargs
1245
+ type BuiltinMethod struct {
1246
+ Name string
1247
+ Fn types.Object
1248
+ Exargs [] interface {}
1249
1249
}
1250
1250
1251
- func (p * builtinMethod ) Results () * types.Tuple {
1252
- return p .fn .Type ().(* types.Signature ).Results ()
1251
+ func (p * BuiltinMethod ) Results () * types.Tuple {
1252
+ return p .Fn .Type ().(* types.Signature ).Results ()
1253
1253
}
1254
1254
1255
- func (p * builtinMethod ) Params () * types.Tuple {
1256
- params := p .fn .Type ().(* types.Signature ).Params ()
1257
- n := params .Len () - len (p .eargs ) - 1
1255
+ func (p * BuiltinMethod ) Params () * types.Tuple {
1256
+ params := p .Fn .Type ().(* types.Signature ).Params ()
1257
+ n := params .Len () - len (p .Exargs ) - 1
1258
1258
if n <= 0 {
1259
1259
return nil
1260
1260
}
@@ -1272,25 +1272,25 @@ type mthdSignature interface {
1272
1272
1273
1273
type BuiltinTI struct {
1274
1274
typ types.Type
1275
- methods []* builtinMethod
1275
+ methods []* BuiltinMethod
1276
1276
}
1277
1277
1278
- func (p * BuiltinTI ) AddMethod ( name string , fn types. Object , eargs ... interface {} ) {
1279
- p .methods = append (p .methods , & builtinMethod { name , fn , eargs } )
1278
+ func (p * BuiltinTI ) AddMethods ( mthds ... * BuiltinMethod ) {
1279
+ p .methods = append (p .methods , mthds ... )
1280
1280
}
1281
1281
1282
1282
func (p * BuiltinTI ) numMethods () int {
1283
1283
return len (p .methods )
1284
1284
}
1285
1285
1286
- func (p * BuiltinTI ) method (i int ) * builtinMethod {
1286
+ func (p * BuiltinTI ) method (i int ) * BuiltinMethod {
1287
1287
return p .methods [i ]
1288
1288
}
1289
1289
1290
1290
func (p * BuiltinTI ) lookupByName (name string ) mthdSignature {
1291
1291
for i , n := 0 , p .numMethods (); i < n ; i ++ {
1292
1292
method := p .method (i )
1293
- if method .name == name {
1293
+ if method .Name == name {
1294
1294
return method
1295
1295
}
1296
1296
}
@@ -1323,7 +1323,7 @@ func initBuiltinTIs(pkg *Package) {
1323
1323
if iox := pkg .TryImport (ioxPkg ); iox .isValid () {
1324
1324
ioxTI = & BuiltinTI {
1325
1325
typ : os .Ref ("File" ).Type (),
1326
- methods : []* builtinMethod {
1326
+ methods : []* BuiltinMethod {
1327
1327
{"Gop_Enum" , iox .Ref ("EnumLines" ), nil },
1328
1328
},
1329
1329
}
@@ -1334,33 +1334,33 @@ func initBuiltinTIs(pkg *Package) {
1334
1334
if strconv .isValid () {
1335
1335
float64TI = & BuiltinTI {
1336
1336
typ : types .Typ [types .Float64 ],
1337
- methods : []* builtinMethod {
1337
+ methods : []* BuiltinMethod {
1338
1338
{"String" , strconv .Ref ("FormatFloat" ), bmExargs {'g' , - 1 , 64 }},
1339
1339
},
1340
1340
}
1341
1341
intTI = & BuiltinTI {
1342
1342
typ : types .Typ [types .Int ],
1343
- methods : []* builtinMethod {
1343
+ methods : []* BuiltinMethod {
1344
1344
{"String" , strconv .Ref ("Itoa" ), nil },
1345
1345
},
1346
1346
}
1347
1347
int64TI = & BuiltinTI {
1348
1348
typ : types .Typ [types .Int64 ],
1349
- methods : []* builtinMethod {
1349
+ methods : []* BuiltinMethod {
1350
1350
{"String" , strconv .Ref ("FormatInt" ), bmExargs {10 }},
1351
1351
},
1352
1352
}
1353
1353
uint64TI = & BuiltinTI {
1354
1354
typ : types .Typ [types .Uint64 ],
1355
- methods : []* builtinMethod {
1355
+ methods : []* BuiltinMethod {
1356
1356
{"String" , strconv .Ref ("FormatUint" ), bmExargs {10 }},
1357
1357
},
1358
1358
}
1359
1359
}
1360
1360
if strings .isValid () && strconv .isValid () {
1361
1361
stringTI = & BuiltinTI {
1362
1362
typ : types .Typ [types .String ],
1363
- methods : []* builtinMethod {
1363
+ methods : []* BuiltinMethod {
1364
1364
{"Len" , btoLen , nil },
1365
1365
{"Count" , strings .Ref ("Count" ), nil },
1366
1366
{"Int" , strconv .Ref ("Atoi" ), nil },
@@ -1406,7 +1406,7 @@ func initBuiltinTIs(pkg *Package) {
1406
1406
if strings .isValid () {
1407
1407
stringSliceTI = & BuiltinTI {
1408
1408
typ : types .NewSlice (types .Typ [types .String ]),
1409
- methods : []* builtinMethod {
1409
+ methods : []* BuiltinMethod {
1410
1410
{"Len" , btoLen , nil },
1411
1411
{"Cap" , btoCap , nil },
1412
1412
{"Join" , strings .Ref ("Join" ), nil },
@@ -1423,20 +1423,20 @@ func initBuiltinTIs(pkg *Package) {
1423
1423
stringSliceTI ,
1424
1424
{
1425
1425
typ : tySlice ,
1426
- methods : []* builtinMethod {
1426
+ methods : []* BuiltinMethod {
1427
1427
{"Len" , btoLen , nil },
1428
1428
{"Cap" , btoCap , nil },
1429
1429
},
1430
1430
},
1431
1431
{
1432
1432
typ : tyMap ,
1433
- methods : []* builtinMethod {
1433
+ methods : []* BuiltinMethod {
1434
1434
{"Len" , btoLen , nil },
1435
1435
},
1436
1436
},
1437
1437
{
1438
1438
typ : tyChan ,
1439
- methods : []* builtinMethod {
1439
+ methods : []* BuiltinMethod {
1440
1440
{"Len" , btoLen , nil },
1441
1441
},
1442
1442
},
0 commit comments