Skip to content

Replace the NoteTag enum with a custom train which would be implemented by companion objects of all nodes #16

@letalvoj

Description

@letalvoj

Kdyby se nahradil

object IntoClause extends NodeDecoder[IntoClause](IntoClause.type) with NodeTag[IntoClause] {

kde ten string by sel ziskat markem / programaticky a NodeTag by byl

trait NodeTag[CC]{
  implicit def decoder:Decoder[CC]
}

object NoteTag{
  def withName(name:String):NodeTag = ??? // tohle by se jedine muselo naimplementovat... ale jelikoz je to runtime vec, tak by to klidne mohla byt reflexe ci co ...
}

tag by byl ten decoder svazanej s tim tagem a tim by se ti tenhle hroznej match

NodeTag.withName(key) match {
  case NodeTag.T_A_Const        => c.as[A_Const]
  case NodeTag.T_A_Expr         => c.as[A_Expr]
  // ... and many many more

zmenil na oneliner

  NodeTag.withName(key).decoder(c)

Metadata

Metadata

Assignees

No one assigned

    Labels

    not-in-thesisNot worth spending time before the thesis is submitted

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions