Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clicking on Name of Custom Datatype Workaround #19

Open
maroon-scorch opened this issue Feb 8, 2021 · 1 comment
Open

Clicking on Name of Custom Datatype Workaround #19

maroon-scorch opened this issue Feb 8, 2021 · 1 comment

Comments

@maroon-scorch
Copy link
Collaborator

Whenever a custom datatype such as the following is rendered in the program:

data Posn:
  | posn(x :: Number, y :: Number)
  | nice(s :: String)
end 

The block node of the title of the datatype "Posn" is rendered as "blocks-node-undefined" with an undefined id, and consequently clicking on the name also crashes the program. The workaround currently is to instead render the title using the String of the title instead. The tradeoff is that custom datatype names are currently uneditable.

The relevant constructor is the class Data in "ast.tsx" and the class s-data in "PyretParser.ts"

@RobScheidegger
Copy link
Collaborator

Fixed by re-implementing the Nodes.Literal rendering and changing Spec.value('name') to Spec.required('name') in the body of the Data AST Node.

However, the problem was that because the spec for the property was value, the block was being rendered with no id since it wasn't being assigned in AST.annotateNodes() in CodemirrorBlocks (since I assume that value tells it that it is not an AST node), which leads me to suggest maybe a check somewhere to catch undefined id prior to render and throw a more precise error. Otherwise, this appears relatively mystic and strange to debug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants