Prepare to add cpu_arch_utility types

This commit is contained in:
Nigel Tao committed 2021-02-18 16:16:48 +11:00
1 parent 869be76fae
commit 492068f3dc
8 files changed
+77 -29

No files matched your search

+2 -3
View File
@@ -47,7 +47,6 @@ var (
typeExprARMNeon64 = a.NewTypeExpr(0, t.IDBase, t.IDARMNeon64, nil, nil, nil)
typeExprARMNeon128 = a.NewTypeExpr(0, t.IDBase, t.IDARMNeon128, nil, nil, nil)
typeExprPixelSwizzler = a.NewTypeExpr(0, t.IDBase, t.IDPixelSwizzler, nil, nil, nil)
typeExprUtility = a.NewTypeExpr(0, t.IDBase, t.IDUtility, nil, nil, nil)
)
// Prefixes are prepended to names to form a namespace and to avoid e.g.
@@ -1075,7 +1074,7 @@ func (g *gen) writeStructPrivateImpl(b *buffer, n *a.Struct) error {
for _, o := range n.Fields() {
o := o.AsField()
if o.PrivateData() || o.XType().Eq(typeExprUtility) {
if o.PrivateData() || o.XType().IsEtcUtilityType() {
continue
}
if err := g.writeCTypeName(b, o.XType(), fPrefix, o.Name().Str(g.tm)); err != nil {
@@ -1128,7 +1127,7 @@ func (g *gen) writeStructPrivateImpl(b *buffer, n *a.Struct) error {
for _, o := range n.Fields() {
o := o.AsField()
if !o.PrivateData() || o.XType().Eq(typeExprUtility) {
if !o.PrivateData() || o.XType().IsEtcUtilityType() {
continue
}
if err := g.writeCTypeName(b, o.XType(), fPrefix, o.Name().Str(g.tm)); err != nil {
+1 -1
View File
@@ -434,7 +434,7 @@ func (g *gen) writeExprUserDefinedCall(b *buffer, n *a.Expr, depth uint32) error
}
qid := recvTyp.QID()
b.printf("%s%s__%s(", g.packagePrefix(qid), qid[1].Str(g.tm), method.Ident().Str(g.tm))
if !recvTyp.Eq(typeExprUtility) {
if !recvTyp.IsEtcUtilityType() {
b.writes(addr)
if err := g.writeExpr(b, recv, false, depth); err != nil {
return err
+6 -5
View File
@@ -238,7 +238,7 @@ func (g *gen) couldHaveDerivedVar(n *a.Expr) bool {
case t.IDOpenParen:
switch n.LHS().AsExpr().Ident() {
case t.IDEmptyIOReader, t.IDEmptyIOWriter:
if n.LHS().AsExpr().LHS().AsExpr().MType().Eq(typeExprUtility) {
if n.LHS().AsExpr().LHS().AsExpr().MType().IsEtcUtilityType() {
return false
}
}
@@ -324,10 +324,11 @@ func (g *gen) writeResumeSuspend(b *buffer, f *funk, suspend bool) error {
func (g *gen) writeVars(b *buffer, f *funk, inStructDecl bool) error {
for _, n := range f.varList {
typ := n.XType()
if inStructDecl {
if typ.HasPointers() || f.varResumables == nil || !f.varResumables[n.Name()] {
continue
}
if typ.Innermost().IsEtcUtilityType() {
continue
} else if inStructDecl &&
(typ.HasPointers() || f.varResumables == nil || !f.varResumables[n.Name()]) {
continue
}
name := n.Name().Str(g.tm)