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

Class-related syntax errors #1813

Closed
shesek opened this issue Oct 29, 2011 · 2 comments
Closed

Class-related syntax errors #1813

shesek opened this issue Oct 29, 2011 · 2 comments

Comments

@shesek
Copy link

shesek commented Oct 29, 2011

Those doesn't work (fails with UNEXPECTED 'INDENT'):

func class bar extends baz then x = 1
func class bar then x = 1
func class bar extends baz
  x = 1

While those does:

class bar extends baz then x = 1 # Works without a function call
class bar then x = 1 # Works without a function call
class bar extends baz # Works without a function call
  x = 1
func class bar extends baz # Works when there's an prototype propertry assignment before other code
  x: 1
  x = 1
func class bar extends baz # Works with classes that doesn't have any content
func class bar # Works with an indented body instead of `then`, but only when the class doesn't extend anything
  x = 1
func (class bar extends baz then x=1) # Works with `()` wrapping the class.

The cases where I get parsing errors seems to be those two:

  • Passing a class with then as an argument to a function.
  • Passing a class that extends another class and starts with regular code (and not prototype property assignment) as an argument to a function.

If anyone else is experiencing that and needs a quick fix, here's what I ended up doing in the meanwhile:

func class foo extends bar
  BUGFIX:1 # See https://github.com/jashkenas/coffee-script/issues/1813

  # ...
@kellypleahy
Copy link

See the code referenced above for a possible indication of how to fix this...

@jashkenas
Copy link
Owner

Should be fixed in the above commit.

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

3 participants