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

add go/types based template type checking #17

Draft
wants to merge 29 commits into
base: main
Choose a base branch
from
Draft

Conversation

crhntr
Copy link
Owner

@crhntr crhntr commented Dec 2, 2024

I'd like to do a source based type checker for templates. I intend to add this to muxt generate and have it run at the end.

Here is some related work art:

This PR is intended to resolve: #3

Design

The signature of the tree based type checker.

func Tree(tree *parse.Tree, data types.Type, pkg *types.Package, fileSet *token.FileSet, trees TreeFinder, functions FunctionFinder) error

Since, safehtml/template, html/template, and text/template all use text/template/parse, the Tree type from parse makes sense as a parameter to the checker.

@crhntr crhntr force-pushed the type-check-templates branch from 36c18cd to a476f5c Compare December 2, 2024 05:15
@crhntr crhntr force-pushed the type-check-templates branch from a07c3ca to 3bc8f7a Compare December 21, 2024 02:24
@crhntr crhntr force-pushed the type-check-templates branch from 3bc8f7a to ff6bdbd Compare December 21, 2024 04:06
@crhntr crhntr marked this pull request as draft December 24, 2024 05:54
@crhntr crhntr force-pushed the type-check-templates branch from d5e4b61 to 021d09b Compare December 27, 2024 02:16
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

Successfully merging this pull request may close these issues.

Use static analysis to validate template actions
1 participant