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

Stencil 0.12 #95

Merged
merged 7 commits into from
Aug 27, 2018
Merged

Stencil 0.12 #95

merged 7 commits into from
Aug 27, 2018

Conversation

djbe
Copy link
Member

@djbe djbe commented Aug 26, 2018

Updated our code as needed:

  • Add token attribute for better errors support
  • Switched to resolvable where possible

  • Had to make the CallableBlock a non-NodeType to avoid rendering during (variable) resolvable resolution.

- Add `token` attribute for better errors support
- Switches to resolvable where possible
- Had to make the `CallableBlock` a non-`NodeType` to avoid rendering during resolvable resolution

t
Copy link
Contributor

@AliSoftware AliSoftware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't read all the tests (only seeing the diff on GitHub so not the best way to view all of them ^^), do we have enough tests especially given the changes in Macro/Call blocks, to test that they properly apply embed filters and expressions like subscripts and all?

let parameters: [String]
let nodes: [NodeType]

init(parameters: [String], nodes: [NodeType], token: Token? = nil) {
self.parameters = parameters
self.nodes = nodes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I get the use of the token parameter here given it's unused?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's mandatory for the new error functionality (stencilproject/Stencil#167).

guard components.count == 4 && components[2] == "into" ||
components.count == 6 && components[2] == "into" && components[4] == "using" else {
func hasToken(_ token: String, at index: Int) -> Bool {
return components.count > (index + 1) && components[index] == token
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I nitpick but I feel it's more readable to write it as index < components.count - 1 instead of the other way around

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I just copied this from stencil (seemed clearer instead of checking a whole bunch of indices). Will update this.

Copy link
Contributor

@AliSoftware AliSoftware Aug 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way is to write if collection.indices ~= index (or is it the other way around I always forget)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the first time I see that (the match operator) used for checking bounds, interesting.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I haven't checked if that works on indices (which is what? A collection?), I know it works on Ranges but didn't check in code that it works work with indices… so curious if that's actually possible 😉

@djbe djbe mentioned this pull request Aug 27, 2018
@djbe djbe merged commit 2f5f77a into master Aug 27, 2018
@djbe djbe deleted the feature/stencil-0.12 branch August 27, 2018 23:51
@djbe djbe added this to the 2.6.0 milestone Oct 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants