Commit Graph

36 Commits

Author SHA1 Message Date
i582
61523ab396 internal: fixed parsing of expression new
1. Now, for the expression 'new A' the correct
values EndLine, EndPos, and not -1 will be set;
2. Also, for expressions from php5 '$a = &new Foo',
the condition for parsing is fixed when it is necessary
to set the Args values and the initialization of the
NewTkn field is added, in the case when this condition
is false.

## Problem description

The reason why the positions after parsing became
incorrect is that the check that is responsible for
separating expressions like 'new A' and 'new A (args)'
relied on comparison with nil, however, when the parser
was updated, 'ctor_arguments' began to return not nil,
but &ArgumentList{}, so the condition was always true,
and in this case, when calculating the position, the
second argument of the 'NewTokenNodePosition' function
was nil, which is why -1 was returned there.

For the second, the reasons are similar. In addition,
there was a mistake in the number that needs to be
checked. In the expression:

'variable' '=' '&' T_NEW class_name_reference ctor_arguments'

it is necessary to check not 3, but 6 elements for nil.
2021-02-04 07:12:56 +03:00
Vadym Slizov
e3b133f3de
refactoring: update api 2020-12-29 21:23:22 +02:00
Vadym Slizov
cb4b4e69c4
refactoring: fix naming 2020-12-28 23:01:02 +02:00
Vadym Slizov
c0465f9605
refactoring: remove "StmtTraitMethodRef" node 2020-12-28 10:47:09 +02:00
Vadym Slizov
c29e8ec0e0
refactoring: update ast structure of "Class", "Interface" and "Trait" nodes 2020-12-28 10:10:24 +02:00
Vadym Slizov
2990f0cc2d
refactoring: create "ScalarEncapsedStringBrackets" node 2020-12-28 00:53:48 +02:00
Vadym Slizov
38141ce97f
refactoring: create "ScalarEncapsedStringVar" node 2020-12-28 00:38:39 +02:00
Vadym Slizov
e4321b5e90
refactoring: create "ExprBrackets" node 2020-12-28 00:02:14 +02:00
Vadym Slizov
2c09138600
refactoring: update ast structure of "Variable" node 2020-12-27 21:55:36 +02:00
Vadym Slizov
115d481a57
refactoring: update ast structure of "IncludeOnce" node 2020-12-26 22:44:14 +02:00
Vadym Slizov
616fd4448e
refactoring: rename DieTkn to ExitTkn 2020-12-26 22:41:25 +02:00
Vadym Slizov
0f5f5e7dc7
refactoring: update ast structure of "ArrayItem" node 2020-12-26 20:13:50 +02:00
Vadym Slizov
8bf1fa822d
refactoring: update ast structure of "Foreach" node 2020-12-26 19:38:45 +02:00
Vadym Slizov
b85bae2ec1
refactoring: update ast structure of "Closure" and "ClosureUse" nodes 2020-12-26 18:20:10 +02:00
Vadym Slizov
03c7979ccd
refactoring: remove StmtTraitAdaptationList node 2020-12-20 23:04:23 +02:00
Vadym Slizov
fd984fea8f
refactoring: update php7 tests 2020-12-20 11:38:13 +02:00
Vadym Slizov
69bc0af2be [refactoring] update ast structure of "Foreach" node 2020-09-14 18:36:55 +03:00
Vadym Slizov
f6cb2bff4d [refactoring] update ast structure of "Switch", "Case", "Default" nodes; remove "CaseList" node 2020-09-06 12:49:08 +03:00
Vadym Slizov
0e73cd8852 [refactoring] update ast structure of "For" node 2020-09-04 11:37:17 +03:00
Vadym Slizov
3b85f5e82b [refactoring] update ast structure of "While" node 2020-09-04 10:33:47 +03:00
Vadym Slizov
6976388a82 [refactoring] update ast structure of "If", "ElseIf", "Else" nodes 2020-09-03 22:18:06 +03:00
Vadym Slizov
c63213630a [refactoring] update ast structure of "Constant" nodes 2020-08-24 23:28:44 +03:00
Vadym Slizov
c1b3e6f5b2 [refactoring] update ast structure of "name" nodes 2020-08-24 14:20:20 +03:00
Vadym Slizov
767187ff85 [refactoring] update ast structure for "Use" and "GroupUse" nodes 2020-08-22 17:00:22 +03:00
Vadym Slizov
97747c5ac0 [refactoring] remove scanner token 2020-08-17 20:39:10 +03:00
Vadym Slizov
394092269a [refactoring] store expr parenthesis 2020-08-09 22:40:55 +02:00
Vadym Slizov
fd5d891037 [refactoring] add Parser nodes for use 2020-08-09 00:56:21 +02:00
Vadym Slizov
feebb017c4 [refactoring] update use ast structure 2020-08-03 21:22:53 +02:00
Vadym Slizov
88dfd32d9e Merge branch 'master' into refactoring 2020-07-29 22:23:44 +02:00
Vadym Slizov
ce18c23597 [refactoring] parameters: new node structure 2020-07-05 22:47:46 +03:00
Vadym Slizov
06d202e71c [refactoring] remove param withTokens from parser 2020-07-03 00:20:32 +03:00
Vadym Slizov
ee3fe3b5c0 [refactoring] keep $ in variable identifier 2020-06-30 00:45:15 +03:00
Vadym Slizov
d7652b1c7f [refactoring] parsing error handler 2020-06-29 23:00:56 +03:00
Vadym Slizov
d9a7d20e73 [refactoring] scanner.Lexer.withHiddenTokens 2020-05-18 21:37:37 +03:00
Vadym Slizov
4971309b75 refactor printer 2020-05-17 22:56:32 +03:00
Vadym Slizov
50f8a47119 update tests 2020-05-14 19:12:13 +03:00