@@ -350,7 +350,7 @@ type pkgCtx struct {
350350 overpos map [string ]token.Pos // overload => pos
351351 fset * token.FileSet
352352 syms map [string ]loader
353- lbinames []any // names that should load before initGopPkg (can be string/func or *ast.Ident/type)
353+ lbinames []any // names that should load before initXGoPkg (can be string/func or *ast.Ident/type)
354354 inits []func ()
355355 tylds []* typeLoader
356356 errs errors.List
@@ -387,7 +387,7 @@ type blockCtx struct {
387387 classRecv * ast.FieldList // available when isClass
388388 baseClass types.Object // available when isClass
389389
390- fileScope * types.Scope // available when isGopFile
390+ fileScope * types.Scope // available when isXGoFile
391391 rec * goxRecorder
392392
393393 fileLine bool
@@ -661,7 +661,7 @@ func NewPackage(pkgPath string, pkg *ast.Package, conf *Config) (p *gogen.Packag
661661 if rec := ctx .rec ; rec != nil {
662662 rec .Scope (f .File , fileScope )
663663 }
664- preloadGopFile (p , ctx , f .path , f .File , conf )
664+ preloadXGoFile (p , ctx , f .path , f .File , conf )
665665 }
666666
667667 proj , multi := gmxCheckProjs (p , ctx )
@@ -682,7 +682,7 @@ func NewPackage(pkgPath string, pkg *ast.Package, conf *Config) (p *gogen.Packag
682682 preloadFile (p , ctx , f , skippingGoFile , false )
683683 }
684684
685- initGopPkg (ctx , p , gopSyms )
685+ initXGoPkg (ctx , p , gopSyms )
686686
687687 // genMain = true if it is main package and no main func
688688 var genMain bool
@@ -741,7 +741,7 @@ func isOverloadFunc(name string) bool {
741741 return n > 3 && name [n - 3 :n - 1 ] == "__"
742742}
743743
744- func initGopPkg (ctx * pkgCtx , pkg * gogen.Package , gopSyms map [string ]bool ) {
744+ func initXGoPkg (ctx * pkgCtx , pkg * gogen.Package , gopSyms map [string ]bool ) {
745745 for name , f := range ctx .syms {
746746 if gopSyms [name ] {
747747 continue
@@ -759,7 +759,7 @@ func initGopPkg(ctx *pkgCtx, pkg *gogen.Package, gopSyms map[string]bool) {
759759 ctx .loadType (lbi .(* ast.Ident ).Name )
760760 }
761761 }
762- gogen .InitThisGopPkgEx (pkg .Types , ctx .overpos )
762+ gogen .InitXGoPackageEx (pkg .Types , ctx .overpos )
763763}
764764
765765func loadFile (ctx * pkgCtx , f * ast.File ) {
@@ -805,7 +805,7 @@ func genGoFile(file string, goxTestFile bool) string {
805805 return defaultGoFile
806806}
807807
808- func preloadGopFile (p * gogen.Package , ctx * blockCtx , file string , f * ast.File , conf * Config ) {
808+ func preloadXGoFile (p * gogen.Package , ctx * blockCtx , file string , f * ast.File , conf * Config ) {
809809 var proj * gmxProject
810810 var c * gmxClass
811811 var classType , gameClass string
@@ -944,7 +944,7 @@ func preloadGopFile(p *gogen.Package, ctx *blockCtx, file string, f *ast.File, c
944944 parent .tylds = append (parent .tylds , ld )
945945 }
946946
947- // bugfix: see TestGopxNoFunc
947+ // bugfix: see TestGoxNoFunc
948948 parent .lbinames = append (parent .lbinames , classType )
949949
950950 ctx .classRecv = & ast.FieldList {List : []* ast.Field {{
@@ -1042,7 +1042,7 @@ func preloadFile(p *gogen.Package, ctx *blockCtx, f *ast.File, goFile string, ge
10421042 log .Println ("==> Preload func" , fname )
10431043 }
10441044 if initLoader (parent , syms , name .Pos (), name .End (), fname , fn , genFnBody ) {
1045- if strings .HasPrefix (fname , "Gopx_ " ) { // Gopx_xxx func
1045+ if strings .HasPrefix (fname , "XGox_ " ) { // XGox_xxx func
10461046 ctx .lbinames = append (ctx .lbinames , fname )
10471047 }
10481048 }
@@ -1281,7 +1281,7 @@ func preloadFile(p *gogen.Package, ctx *blockCtx, f *ast.File, goFile string, ge
12811281 break LoopFunc
12821282 }
12831283 name1 := overloadFuncName (name .Name , idx )
1284- onames = append (onames , "" ) // const Gopo_xxx = "xxxInt,,xxxFloat"
1284+ onames = append (onames , "" ) // const XGoo_xxx = "xxxInt,,xxxFloat"
12851285 ctx .lbinames = append (ctx .lbinames , name1 )
12861286 id := & ast.Ident {NamePos : expr .Pos (), Name : name1 }
12871287 if ctx .rec != nil {
@@ -1298,7 +1298,7 @@ func preloadFile(p *gogen.Package, ctx *blockCtx, f *ast.File, goFile string, ge
12981298 break LoopFunc
12991299 }
13001300 }
1301- if exov { // need Gopo_xxx
1301+ if exov { // need XGoo_xxx
13021302 oname , err := overloadName (recv , name .Name , d .Operator )
13031303 if err != nil {
13041304 ctx .handleErrorf (name .Pos (), name .End (), "%v" , err )
@@ -1356,7 +1356,7 @@ func overloadFuncName(name string, idx int) string {
13561356
13571357func overloadName (recv * ast.Ident , name string , isOp bool ) (string , error ) {
13581358 if isOp {
1359- if oname , ok := binaryGopNames [name ]; ok {
1359+ if oname , ok := binaryXGoNames [name ]; ok {
13601360 name = oname
13611361 } else {
13621362 return "" , fmt .Errorf ("invalid overload operator %v" , name )
@@ -1370,15 +1370,15 @@ func overloadName(recv *ast.Ident, name string, isOp bool) (string, error) {
13701370 if recv != nil {
13711371 typ = recv .Name + sep
13721372 }
1373- return "Gopo " + sep + typ + name , nil
1373+ return "XGoo " + sep + typ + name , nil
13741374}
13751375
13761376func staticMethod (tname , name string ) string {
13771377 sep := "_"
13781378 if strings .ContainsRune (name , '_' ) || strings .ContainsRune (tname , '_' ) {
13791379 sep = "__"
13801380 }
1381- return "Gops " + sep + tname + sep + name
1381+ return "XGos " + sep + tname + sep + name
13821382}
13831383
13841384func stringLit (val string ) * ast.BasicLit {
@@ -1439,11 +1439,11 @@ func loadFunc(ctx *blockCtx, recv *types.Var, name string, d *ast.FuncDecl, genB
14391439 }
14401440 } else if d .Operator {
14411441 if recv != nil { // binary op
1442- if v , ok := binaryGopNames [name ]; ok {
1442+ if v , ok := binaryXGoNames [name ]; ok {
14431443 name = v
14441444 }
14451445 } else { // unary op
1446- if v , ok := unaryGopNames [name ]; ok {
1446+ if v , ok := unaryXGoNames [name ]; ok {
14471447 name = v
14481448 at := pkg .Types
14491449 arg1 := d .Type .Params .List [0 ]
@@ -1487,57 +1487,57 @@ func loadFunc(ctx *blockCtx, recv *types.Var, name string, d *ast.FuncDecl, genB
14871487 }
14881488}
14891489
1490- var binaryGopNames = map [string ]string {
1491- "+" : "Gop_Add " ,
1492- "-" : "Gop_Sub " ,
1493- "*" : "Gop_Mul " ,
1494- "/" : "Gop_Quo " ,
1495- "%" : "Gop_Rem " ,
1496-
1497- "&" : "Gop_And " ,
1498- "|" : "Gop_Or " ,
1499- "^" : "Gop_Xor " ,
1500- "<<" : "Gop_Lsh " ,
1501- ">>" : "Gop_Rsh " ,
1502- "&^" : "Gop_AndNot " ,
1503-
1504- "+=" : "Gop_AddAssign " ,
1505- "-=" : "Gop_SubAssign " ,
1506- "*=" : "Gop_MulAssign " ,
1507- "/=" : "Gop_QuoAssign " ,
1508- "%=" : "Gop_RemAssign " ,
1509-
1510- "&=" : "Gop_AndAssign " ,
1511- "|=" : "Gop_OrAssign " ,
1512- "^=" : "Gop_XorAssign " ,
1513- "<<=" : "Gop_LshAssign " ,
1514- ">>=" : "Gop_RshAssign " ,
1515- "&^=" : "Gop_AndNotAssign " ,
1516-
1517- "==" : "Gop_EQ " ,
1518- "!=" : "Gop_NE " ,
1519- "<=" : "Gop_LE " ,
1520- "<" : "Gop_LT " ,
1521- ">=" : "Gop_GE " ,
1522- ">" : "Gop_GT " ,
1523-
1524- "->" : "Gop_PointTo " ,
1525- "<>" : "Gop_PointBi " ,
1526-
1527- "&&" : "Gop_LAnd " ,
1528- "||" : "Gop_LOr " ,
1529-
1530- "<-" : "Gop_Send " ,
1531- }
1532-
1533- var unaryGopNames = map [string ]string {
1534- "++" : "Gop_Inc " ,
1535- "--" : "Gop_Dec " ,
1536- "-" : "Gop_Neg " ,
1537- "+" : "Gop_Dup " ,
1538- "^" : "Gop_Not " ,
1539- "!" : "Gop_LNot " ,
1540- "<-" : "Gop_Recv " ,
1490+ var binaryXGoNames = map [string ]string {
1491+ "+" : "XGo_Add " ,
1492+ "-" : "XGo_Sub " ,
1493+ "*" : "XGo_Mul " ,
1494+ "/" : "XGo_Quo " ,
1495+ "%" : "XGo_Rem " ,
1496+
1497+ "&" : "XGo_And " ,
1498+ "|" : "XGo_Or " ,
1499+ "^" : "XGo_Xor " ,
1500+ "<<" : "XGo_Lsh " ,
1501+ ">>" : "XGo_Rsh " ,
1502+ "&^" : "XGo_AndNot " ,
1503+
1504+ "+=" : "XGo_AddAssign " ,
1505+ "-=" : "XGo_SubAssign " ,
1506+ "*=" : "XGo_MulAssign " ,
1507+ "/=" : "XGo_QuoAssign " ,
1508+ "%=" : "XGo_RemAssign " ,
1509+
1510+ "&=" : "XGo_AndAssign " ,
1511+ "|=" : "XGo_OrAssign " ,
1512+ "^=" : "XGo_XorAssign " ,
1513+ "<<=" : "XGo_LshAssign " ,
1514+ ">>=" : "XGo_RshAssign " ,
1515+ "&^=" : "XGo_AndNotAssign " ,
1516+
1517+ "==" : "XGo_EQ " ,
1518+ "!=" : "XGo_NE " ,
1519+ "<=" : "XGo_LE " ,
1520+ "<" : "XGo_LT " ,
1521+ ">=" : "XGo_GE " ,
1522+ ">" : "XGo_GT " ,
1523+
1524+ "->" : "XGo_PointTo " ,
1525+ "<>" : "XGo_PointBi " ,
1526+
1527+ "&&" : "XGo_LAnd " ,
1528+ "||" : "XGo_LOr " ,
1529+
1530+ "<-" : "XGo_Send " ,
1531+ }
1532+
1533+ var unaryXGoNames = map [string ]string {
1534+ "++" : "XGo_Inc " ,
1535+ "--" : "XGo_Dec " ,
1536+ "-" : "XGo_Neg " ,
1537+ "+" : "XGo_Dup " ,
1538+ "^" : "XGo_Not " ,
1539+ "!" : "XGo_LNot " ,
1540+ "<-" : "XGo_Recv " ,
15411541}
15421542
15431543func loadFuncBody (ctx * blockCtx , fn * gogen.Func , body * ast.BlockStmt , sigBase * types.Signature , src ast.Node ) {
0 commit comments