mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 16:55:11 +01:00
Remove the unnecessary ast.Node.ID2 field.
This commit is contained in:
1 parent
36c86e473f
commit
264f444dac
2 files changed
+16
-15
No files matched your search
+13
-12
@@ -17,11 +17,11 @@ const (
|
|||||||
|
|
||||||
// KExpr is an expression, such as "i", "+j" or "k + l[m].n".
|
// KExpr is an expression, such as "i", "+j" or "k + l[m].n".
|
||||||
// - ID0: <0|operator|IDOpenBracket|IDDot>
|
// - ID0: <0|operator|IDOpenBracket|IDDot>
|
||||||
// - ID2: <0|identifier name|literal>
|
// - ID1: <0|identifier name|literal>
|
||||||
// - LHS: <nil|KExpr>
|
// - LHS: <nil|KExpr>
|
||||||
// - RHS: <nil|KExpr|KType>
|
// - RHS: <nil|KExpr|KType>
|
||||||
//
|
//
|
||||||
// A zero ID0 means an identifier or literal in ID2, like "foo" or "42".
|
// A zero ID0 means an identifier or literal in ID1, like "foo" or "42".
|
||||||
//
|
//
|
||||||
// For unary operators, ID0 is the operator and RHS is the operand.
|
// For unary operators, ID0 is the operator and RHS is the operand.
|
||||||
//
|
//
|
||||||
@@ -47,19 +47,21 @@ const (
|
|||||||
KParam
|
KParam
|
||||||
|
|
||||||
// KType is a type, such as "u32", "pkg.foo", "ptr T" or "[8] T".
|
// KType is a type, such as "u32", "pkg.foo", "ptr T" or "[8] T".
|
||||||
// - ID0: <0|IDPtr>
|
// - ID0: <0|package name|IDPtr>
|
||||||
// - ID1: <0|package name>
|
// - ID1: <0|type name>
|
||||||
// - ID2: <0|type name>
|
// - LHS: <nil|KExpr>
|
||||||
// - LHS: TODO.
|
|
||||||
// - RHS: <nil|KType>
|
// - RHS: <nil|KType>
|
||||||
//
|
//
|
||||||
// A zero ID0 means an undecorated type like "u32" or "pkg.foo". ID1 is
|
// A zero ID0 means an undecorated type like "u32" or "foo". ID1 is
|
||||||
// zero or "pkg". ID2 is "u32" or "foo". RHS is nil.
|
// zero or "pkg". ID1 is "u32" or "foo". RHS is nil.
|
||||||
//
|
//
|
||||||
// A non-zero ID0 means a decorated type like "ptr T" or "[8] T". ID0 is
|
// An IDPtr ID0 means "ptr RHS".
|
||||||
// the decoration. LHS is nil or "8". RHS is the T. ID1 and ID2 are zero.
|
//
|
||||||
|
// An IDOpenBracket ID0 means "[LHS] RHS".
|
||||||
|
//
|
||||||
|
// Other ID0 values mean a package-qualified type like "pkg.foo". ID0 is
|
||||||
|
// the "pkg", ID1 is the "foo".
|
||||||
//
|
//
|
||||||
// TODO: LHS for arrays (and slices?), such as "[8] T".
|
|
||||||
// TODO: refinements, such as "u32~[:4096]".
|
// TODO: refinements, such as "u32~[:4096]".
|
||||||
KType
|
KType
|
||||||
|
|
||||||
@@ -105,7 +107,6 @@ type Node struct {
|
|||||||
Flags Flags
|
Flags Flags
|
||||||
ID0 token.ID
|
ID0 token.ID
|
||||||
ID1 token.ID
|
ID1 token.ID
|
||||||
ID2 token.ID
|
|
||||||
LHS *Node // Left Hand Side.
|
LHS *Node // Left Hand Side.
|
||||||
RHS *Node // Right Hand Side.
|
RHS *Node // Right Hand Side.
|
||||||
List0 []*Node
|
List0 []*Node
|
||||||
|
|||||||
+3
-3
@@ -202,14 +202,14 @@ func (p *parser) parseType() (*a.Node, error) {
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
id1, id2, err := p.parseQualifiedIdent()
|
id0, id1, err := p.parseQualifiedIdent()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &a.Node{
|
return &a.Node{
|
||||||
Kind: a.KType,
|
Kind: a.KType,
|
||||||
|
ID0: id0,
|
||||||
ID1: id1,
|
ID1: id1,
|
||||||
ID2: id2,
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,6 +327,6 @@ func (p *parser) parseOperand() (*a.Node, error) {
|
|||||||
|
|
||||||
return &a.Node{
|
return &a.Node{
|
||||||
Kind: a.KExpr,
|
Kind: a.KExpr,
|
||||||
ID2: id,
|
ID1: id,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user