Skip to content

Parsing result is wrong. Is this a bug? #166

@fengdai

Description

@fengdai

Code:

@Anno("xyz")
object A {
}

Parsing result:

(source_file [0, 0] - [4, 0]
  (object_declaration [0, 0] - [2, 1]
    (modifiers [0, 0] - [0, 12]
      (annotation [0, 0] - [0, 12]
        (constructor_invocation [0, 1] - [0, 12]
          (user_type [0, 1] - [0, 5]
            (type_identifier [0, 1] - [0, 5]))
          (value_arguments [0, 5] - [0, 12]
            (value_argument [0, 6] - [0, 11]
              (string_literal [0, 6] - [0, 11]
                (string_content [0, 7] - [0, 10])))))))
    (type_identifier [1, 7] - [1, 8])
    (class_body [1, 9] - [2, 1])))

But, when there is another object B in the same level:

@Anno("xyz")
object A {
}

object B {
}

Parsing result of object A is totally different:

(source_file [0, 0] - [6, 0]
  (prefix_expression [0, 0] - [0, 12]
    (annotation [0, 0] - [0, 5]
      (user_type [0, 1] - [0, 5]
        (type_identifier [0, 1] - [0, 5])))
    (parenthesized_expression [0, 5] - [0, 12]
      (string_literal [0, 6] - [0, 11]
        (string_content [0, 7] - [0, 10]))))
  (object_declaration [1, 0] - [2, 1]
    (type_identifier [1, 7] - [1, 8])
    (class_body [1, 9] - [2, 1]))
  (object_declaration [4, 0] - [5, 1]
    (type_identifier [4, 7] - [4, 8])
    (class_body [4, 9] - [5, 1])))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions