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

Parser struggles to parse object_type in interface_declaration #62

Closed
iwatakeshi opened this issue Aug 21, 2018 · 2 comments
Closed

Parser struggles to parse object_type in interface_declaration #62

iwatakeshi opened this issue Aug 21, 2018 · 2 comments

Comments

@iwatakeshi
Copy link

I don't think it's a major issue, but it seems that if a call_signature is used after another type. The parser cannot recognize that a call_signature exists.

For example,

interface A {
  /**
   * description
   */
  func (x: string): void
  /**
   * description
   */
  (x: string): void
}

outputs

[ SyntaxNode {
  type: comment,
  startPosition: {row: 9, column: 2},
  endPosition: {row: 11, column: 5},
  childCount: 0,
},
  SyntaxNode {
  type: method_signature,
  startPosition: {row: 12, column: 2},
  endPosition: {row: 12, column: 24},
  childCount: 2,
},
  SyntaxNode {
  type: comment,
  startPosition: {row: 13, column: 2},
  endPosition: {row: 15, column: 5},
  childCount: 0,
} ]

If the call_signature is defined first then the parser would parse correctly:

interface A {
  /**
   * description
   */
  (x: string): void
  /**
   * description
   */
  func (x: string): void

}

outputs

[ SyntaxNode {
  type: comment,
  startPosition: {row: 9, column: 2},
  endPosition: {row: 11, column: 5},
  childCount: 0,
},
  SyntaxNode {
  type: call_signature,
  startPosition: {row: 12, column: 2},
  endPosition: {row: 12, column: 19},
  childCount: 2,
},
  SyntaxNode {
  type: comment,
  startPosition: {row: 13, column: 2},
  endPosition: {row: 15, column: 5},
  childCount: 0,
},
  SyntaxNode {
  type: method_signature,
  startPosition: {row: 16, column: 2},
  endPosition: {row: 16, column: 24},
  childCount: 2,
} ]

Another interesting thing to note is that if a comma was added after the method_definition, then the parser would parse correctly.

I'm currently using VSCode and it doesn't warn me about the order properties are defined so I'm sure its syntactically correct.

@maxbrunsfeld
Copy link
Contributor

Yeah, it looks like our automatic semicolon should be kicking in after the method declaration, but it's not.

kevinsawicki pushed a commit that referenced this issue Jan 8, 2019
Allow sequence expressions in more places
@maxbrunsfeld
Copy link
Contributor

Sorry that went unfixed for a year. Fixed on master.

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

2 participants