Answer prose round 1: readName and readField say one idea a sentence and name what each pick and read is, and the test's message names whose b it checks
This commit is contained in:
@@ -141,11 +141,12 @@ func (sc renderScope) frameOf(scope *nameScope) *pickFrame {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// readName reads a from its name's pick in the frame rendering the name's scope. A read entering
|
// readName reads the arm a from the pick of its name, held in the frame of the name's scope.
|
||||||
// another category takes the frames of the name scopes there from the pick's memo (enter), and
|
// When the pick renders another category, enter takes that category's frames from the pick's
|
||||||
// renderFrame finds them and opens none, so every read of the pick reads one pick of each name
|
// memo, and renderFrame finds them and opens no new one.
|
||||||
// bound there: {a.street} and {a.postal-code} in data/sv_SE/address.json read one pick of the
|
// So every read through one pick sees one pick of each name the other category binds:
|
||||||
// name l that data/geo/SE/address.json binds.
|
// {a.street} and {a.postal-code} in data/sv_SE/address.json read one pick of the name l
|
||||||
|
// that data/geo/SE/address.json binds.
|
||||||
func readName(s *drawstate.State, sc renderScope, a arm) readValue {
|
func readName(s *drawstate.State, sc renderScope, a arm) readValue {
|
||||||
f := sc.frameOf(a.named.scope)
|
f := sc.frameOf(a.named.scope)
|
||||||
if f == nil {
|
if f == nil {
|
||||||
|
|||||||
+1
-1
@@ -340,7 +340,7 @@ func TestAFreshReadInsideANamedPickSharesNoValueWithIt(t *testing.T) {
|
|||||||
for i := 0; i < 100; i++ {
|
for i := 0; i < 100; i++ {
|
||||||
got := mustRender(t, f, src)
|
got := mustRender(t, f, src)
|
||||||
if m := want.FindStringSubmatch(got); m == nil || m[1] != m[2] {
|
if m := want.FindStringSubmatch(got); m == nil || m[1] != m[2] {
|
||||||
t.Fatalf("draw %d = %q, want p.a's c drawn afresh and its b read from p's pick", i, got)
|
t.Fatalf("draw %d = %q, want c's b from x, y or z, and p.a's b equal to {p.a.b}", i, got)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,11 +142,12 @@ func expand(s *drawstate.State, t *template, sc renderScope) string {
|
|||||||
return b.String()
|
return b.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// readField renders one arm of a token. A read of a name, or of a level a read of the name
|
// readField renders one arm of a token. A read is kept in a name's pick when it reads the name, or
|
||||||
// rendering addresses, is kept in that name's pick; every other read draws afresh, so {word}
|
// a level that a read of the name being rendered addresses; every other read draws afresh, so
|
||||||
// {word} draws twice and {p.a} {p.b} reads two draws of p. A fresh read leaves the pick: a read
|
// {word} {word} draws twice and {p.a} {p.b} reads two draws of p.
|
||||||
// below it would key the pick's memo by sc.pickKey, the level the pick rendered, so it and the
|
// A fresh read clears sc.pick. Kept, a read nested in the fresh one would key the pick's memo by
|
||||||
// pick would read one value for two nodes.
|
// sc.pickKey, the path from the name to what the pick renders, and share a value with a different
|
||||||
|
// node at that path.
|
||||||
func readField(s *drawstate.State, t *template, sc renderScope, a arm) readValue {
|
func readField(s *drawstate.State, t *template, sc renderScope, a arm) readValue {
|
||||||
switch {
|
switch {
|
||||||
case a.kind == namedRead:
|
case a.kind == namedRead:
|
||||||
|
|||||||
Reference in New Issue
Block a user