Skip to content

Conversation

@LostKobrakai
Copy link
Contributor

As described in #2688

@Conduitry
Copy link
Member

I think this sounds like a reasonable enhancement. Can you swap out the parser test though for a runtime test (like the others in test/runtime) which tests the behavior of the compiled component, rather than just looks at the AST?

const colon_index = name.indexOf(':');
const type = colon_index !== -1 && get_directive_type(name.slice(0, colon_index));

if (unique_names.has(name) && type != "EventHandler") {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (unique_names.has(name) && type != "EventHandler") {
if (unique_names.has(name) && type !== "EventHandler") {

Not that it would really matter here, but we are trying to use non-coercion comparisons everywhere.

}, start);
}

unique_names.add(name);
Copy link
Member

Choose a reason for hiding this comment

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

It might be nicer to not even add to unique_names if we have a type of "EventHandler".

@LostKobrakai
Copy link
Contributor Author

@Conduitry I've implemented your suggestions into the pr.

@Rich-Harris Rich-Harris merged commit 861c742 into sveltejs:master May 12, 2019
@Rich-Harris
Copy link
Member

Thanks, this is a nice enhancement

@ematipico
Copy link
Contributor

Should the documentation be updated?

ematipico added a commit to ematipico/svelte that referenced this pull request May 20, 2019
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.

4 participants