-
Notifications
You must be signed in to change notification settings - Fork 225
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
Convert Token from enum to struct #256
Conversation
Sources/Tokenizer.swift
Outdated
public let sourceMap: SourceMap | ||
|
||
/// Returns the underlying value as an array seperated by spaces | ||
public lazy var components: [String] = self.contents.smartSplit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't that be private(set)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may also want to avoid splitting into components if the type is text?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can return just one item with the whole content, but I think this should be handled on a higher level and might as well not happening at all due to the logic flow
Quick question: how did you measure a slowdown? |
in the performance test, it went from 250-something to 260-something |
The performance test is always a bit inconsistent though, you have to run it a few times to get an idea if it's a fluke, or an actual increase. Anyway, 10ms increase isn't a problem in this case. |
What we're not noticing now, is a potential performance benefit in other parts of Stencil, as we only measure the lexer performance. |
Code looks GTM. Might be worth adding documentation like I did in cb4e514, the current codebase can be quite complicated for developers to understand, and the docs should help with that. Also, don't forget a changelog entry! 😉 |
@djbe there is not really much to document except type properties, which are self-explanatory IMO, the |
Resolves #255. Strangely enough, it makes parsing slightly slower, but I still think it's a good thing to do.
I didn't want to change too much code so I left static constructors instead of cases for interface to be the same.