Commit fcda4cc7 authored by Eric Myhre's avatar Eric Myhre

One more larger struct in the codegen test corpus.

This one was particularly aimed at making sure I hit all the hardest
situations as trying to write the generators for NodeBuilders.

It certainly did so!  I found enough conceptual/design work to do that
I'm actually going to park this here for a while, probably land this
branch back to master before it gets any longer, and then approach
things from some other angles for a while.

In particular: We're going to need several *different* NodeBuilders
for schema-typed nodes.  The astute reader probably already noticed
this, as it's implied by the `typed.Node{}.Representation() Node`
method: that adds a second Node instance, and that means a second
NodeBuilder.  What's a little more fun yet is there might be more than
two: for example, if we want the serial mode to support variation in
field order for structs, that's another branch we need to account for
somewhere... and, ordered vs unordered modes might need different
structures of memory to do their job efficiently, so that means wholly
different implementations of the interface.  Whee.

So.  I'm thinking I might switch tack to knocking around in the
(non-codegen) typed Node package for a while and making sure nothing
looks wildly amiss over there while exploring these same features
Then, when coming back here: looks like we're due for that breakdown
of `EmitNodeBuilder{Detail...}` methods: and perhaps that's
actually going to belong on a new type rather than glommed on flatly
to `typeGenerator`... since there may be a n:1 relationship there!
parent 41aed25d
...@@ -59,6 +59,15 @@ func TestNuevo(t *testing.T) { ...@@ -59,6 +59,15 @@ func TestNuevo(t *testing.T) {
)}, )},
schema.StructRepresentation_Map{}, schema.StructRepresentation_Map{},
) )
tStroct := schema.SpawnStruct("Stroct",
[]schema.StructField{
schema.SpawnStructField("f1", tString, false, false),
schema.SpawnStructField("f2", tString, true, false),
schema.SpawnStructField("f3", tString, true, true),
schema.SpawnStructField("f4", tString, false, false),
},
schema.StructRepresentation_Map{},
)
f = openOrPanic("_test/tString.go") f = openOrPanic("_test/tString.go")
emitFileHeader(f) emitFileHeader(f)
...@@ -75,4 +84,8 @@ func TestNuevo(t *testing.T) { ...@@ -75,4 +84,8 @@ func TestNuevo(t *testing.T) {
f = openOrPanic("_test/Stract3.go") f = openOrPanic("_test/Stract3.go")
emitFileHeader(f) emitFileHeader(f)
emitType(NewGeneratorForKindStruct(tStract3), f) emitType(NewGeneratorForKindStruct(tStract3), f)
f = openOrPanic("_test/Stroct.go")
emitFileHeader(f)
emitType(NewGeneratorForKindStruct(tStroct), f)
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment