Skip to content

broken ast for $$$$$ #248

@alexander-akait

Description

@alexander-akait

Input:

get_class($var)::$$$$$property;

Two problem:

  • leading comments property 😕
Variable {
        kind: 'variable',
        leadingComments:
         Location {
           source: '$$$$property',
           start: Position { line: 3, column: 18, offset: 25 },
           end: Position { line: 3, column: 30, offset: 37 } },
        name:
         Variable {
           kind: 'variable',
           leadingComments:
            Location { source: '$$$property', start: [Position], end: [Position] },
           name:
            Variable {
              kind: 'variable',
              loc: [Location],
              name: [Variable],
              byref: false,
              curly: false },
           byref: false,
           curly: false },
        byref: false,
        curly: false }
  • invalid count of variable nodes (now is 4), but should be 5

Simple example:

get_class($var)::$$property;

Output from php parser:

array(
    0: Stmt_Expression(
        expr: Expr_StaticPropertyFetch(
            class: Expr_FuncCall(
                name: Name(
                    parts: array(
                        0: get_class
                    )
                )
                args: array(
                    0: Arg(
                        value: Expr_Variable(
                            name: var
                        )
                        byRef: false
                        unpack: false
                    )
                )
            )
            name: Expr_Variable(
                name: Expr_Variable(
                    name: Expr_Variable(
                        name: Expr_Variable(
                            name: property
                        )
                    )
                )
            )
        )
    )
)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions