Skip to content

Lexer: “unexpected indentation” with yield followed by implicit object #5054

@izotos

Description

@izotos

Possible bug or unintended behavior:

gen = ->
    yield
      k: 'v'

/#try link

Expected Behavior

Compile same as:

gen = ->
    yield k: 'v'
# or
gen = ->
    yield {
        k: 'v'
    }

Current Behavior

Gives compile error:

[stdin]:3:1: error: unexpected indentation
      k: 'v'
^^^^^^

Context

I was expecting to use yield same as functions and statements like return or throw. This type of syntax is quite handy when returning multi key objects.

Environment

  • CoffeeScript version: 2.3.0
  • Node.js version: 8.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions