type.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package node
  2. type MaybeType interface { MaybeType() }
  3. func (impl VariousType) MaybeType() {}
  4. type VariousType struct {
  5. Node `part:"type"`
  6. Type Type `use:"first"`
  7. }
  8. type Type interface { Type() }
  9. func (impl TypeRef) Type() {}
  10. type TypeRef struct {
  11. Node `part:"type_ref"`
  12. Ref Ref `part:"ref"`
  13. }
  14. func (impl TypeLiteral) Type() {}
  15. type TypeLiteral struct {
  16. Node `part:"type_literal"`
  17. Repr VariousRepr `part:"repr"`
  18. }
  19. type VariousRepr struct {
  20. Node `part:"repr"`
  21. Repr Repr `use:"first"`
  22. }
  23. type Repr interface { Repr() }
  24. func (impl ReprTuple) Repr() {}
  25. type ReprTuple struct {
  26. Node `part:"repr_tuple"`
  27. Elements [] VariousType `list_more:"type_list" item:"type"`
  28. }
  29. func (impl ReprBundle) Repr() {}
  30. type ReprBundle struct {
  31. Node `part:"repr_bundle"`
  32. Fields [] Field `list_more:"field_list" item:"field"`
  33. }
  34. type Field struct {
  35. Node `part:"field"`
  36. Name Identifier `part:"name"`
  37. Type VariousType `part:"type"`
  38. }
  39. func (impl ReprFunc) Repr() {}
  40. type ReprFunc struct {
  41. Node `part:"repr_func"`
  42. Input VariousType `part:"input_type.type"`
  43. Output VariousType `part:"output_type.type"`
  44. }