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

Syntax Questions #15

Open
rwaldron opened this issue Nov 9, 2017 · 6 comments
Open

Syntax Questions #15

rwaldron opened this issue Nov 9, 2017 · 6 comments

Comments

@rwaldron
Copy link

rwaldron commented Nov 9, 2017

  1. What does this mean:
a 
{}
  1. What does this mean:
a()
{}
@leobalter
Copy link

a NoLineTerminator is certainly required to avoid breaking a matching LHSExpressoin + a Block

@samuelgoto
Copy link
Owner

Right, this came up while running this by @waldemarhorwat. In the current formulation, as @leobalter said, these two things would mean different things.

a 
{}

Are two statements, one with a as an identifier and the second as an object literal {}.

On (2), the same thinking applies:

a()
{}

It means a method call a() and an object literal {}.

Does that make sense?

@leobalter
Copy link

Are two statements, one with a as an identifier and the second as an object literal {}.

it's not an object literal, it's a Block. ASI needs to prevail as both are valid code already.

var a = 42;
a
{}

The completion value should be 42 (getting a)

@samuelgoto
Copy link
Owner

samuelgoto commented Nov 9, 2017 via email

@rwaldron
Copy link
Author

rwaldron commented Nov 9, 2017

@samuelgoto

Does that make sense?

Mostly, but @leobalter already pointed out the important corrections.

Still, point being that this is NOT equivalent to a(function {}).

That's what I was hoping to verify. This issue can be closed once a valid grammar exists which satisfies the requirement, ideally @leobalter's recommendation.

@samuelgoto
Copy link
Owner

a NoLineTerminator is certainly required to avoid breaking a matching LHSExpressoin + a Block

@leobalter 's recommendation works for me. I'm going to keep this open just to make sure we don't forget this when writing a more specific spec (the text right now is very informal).

good catch, thanks!

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

No branches or pull requests

3 participants