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

Create local variables from @param declarations #9

Open
segabor opened this issue Dec 15, 2018 · 0 comments
Open

Create local variables from @param declarations #9

segabor opened this issue Dec 15, 2018 · 0 comments

Comments

@segabor
Copy link
Owner

segabor commented Dec 15, 2018

Templates can declare explicit parameters with type, like

{template .demoSwitch}
  {@param name: string}  /** The name of a kid. */
{/template}

Those parameters should be extracted to local variables

guard let name = data["name"] as SoyValue else {
 // blow up with bad parameter error
 // also check if name variable is a SoyValue.string
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant