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
cb4b4e69c4
refactoring: fix naming
2020-12-28 23:01:02 +02:00
Vadym Slizov
07f49a4d21
refactoring: move internal nodes
2020-12-28 21:31:24 +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
ad884c99df
refactoring: update ast structure of "StaticCall" node
2020-12-27 23:19:49 +02:00
Vadym Slizov
0f2341bfa9
refactoring: update ast structure of "MethodCall" and "PropertyFetch" nodes
2020-12-27 23:04:09 +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
a593760569
refactoring: remove ExprReference node
2020-12-26 22:38:35 +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
c32f5bd29b
[refactoring] remove Alt flags
2020-12-11 17:34:29 +02:00
Vadym Slizov
5291529a37
[refactoring] fix typo
2020-12-11 17:29:22 +02:00
Vadym Slizov
497e7f82ee
[refactoring] update printer
2020-12-11 09:54:26 +02:00
Vadym Slizov
f3a605aba1
[refactoring] update position builder
2020-12-08 02:08:59 +02:00
Vadym Slizov
20a42da7c9
[refactoring] remove general Node struct
2020-12-08 00:04:12 +02:00
Vadym Slizov
dfe8982121
refactoring: fix panic when missed arguments list
2020-12-04 22:37:06 +02:00
Vadym Slizov
997f7bc6e4
refactoring: fix panic when empty return type
2020-12-04 22:13:12 +02:00
Vadym Slizov
40b944a272
[refactoring] update ast structure of "ClassConstList", "Constant", "Use", "GroupUse", "UseDeclaration", "Closure", "Name", "FullyQualified", "Relative" and "NamePart" nodes
2020-12-04 14:38:47 +02:00
Vadym Slizov
94897d8c66
[refactoring] remove *FreeFloating* functions
2020-12-04 13:10:12 +02:00
Vadym Slizov
ea3c5298e2
[refactoring] update ast structure of "For", "TraitUseAlias" and "TraitUsePrecedence" nodes
2020-12-04 12:49:13 +02:00
Vadym Slizov
132db0e06b
[refactoring] update ast structure of "ClassMethod", "Function", "ArrowFunction" and "Closure" nodes
2020-12-04 12:22:06 +02:00
Vadym Slizov
f3203c0b5f
[refactoring] update ast structure of "Parameter", "Class", "FunctionCall", "MethodCall", "New" and "StaticCall" nodes
2020-12-04 11:36:12 +02:00
Vadym Slizov
df1626b7dc
[refactoring] update ast structure of "Root" and "Class" nodes
2020-12-04 11:02:38 +02:00
Vadym Slizov
d19b3f609e
[refactoring] update ast structure of "Assign" and "Binary" nodes
2020-12-04 10:40:48 +02:00
Vadym Slizov
5a6418e853
[refactoring] update ast structure of "Yield", "YieldFrom" and "Cast" nodes
2020-12-04 09:42:45 +02:00
Vadym Slizov
01d695c416
[refactoring] update ast structure of "ArrayDimFetch", "UnaryMinus", "ExprUnaryPlus" and "Variable" nodes
2020-12-04 00:13:28 +02:00
Vadym Slizov
13436b88a7
[refactoring] update ast structure of "ShellExec", "StaticCall", "StaticPropertyFetch" and "Ternary" nodes
2020-12-03 22:41:08 +02:00
Vadym Slizov
592c9b9aff
[refactoring] update ast structure of "Print", "Reference", "Require" and "RequireOnce" nodes
2020-12-03 22:20:50 +02:00
Vadym Slizov
45e959056b
[refactoring] update ast structure of "PostDec", "PostInc", "PreDec", "PreInc" and "New" nodes
2020-12-03 22:04:59 +02:00
Vadym Slizov
b1e9f5e167
[refactoring] update ast structure of "ExprMethodCall" and "ExprPropertyFetch" nodes
2020-12-03 21:42:16 +02:00
Vadym Slizov
b5ef30eb36
[refactoring] update ast structure of "InstanceOf" and "Isset" nodes
2020-12-01 12:16:46 +02:00
Vadym Slizov
9b122de8bf
[refactoring] update ast structure of "Eval", "Exit", "FunctionCall", "Include" and "IncludeOnce" nodes
2020-12-01 11:58:09 +02:00
Vadym Slizov
2d240e9475
[refactoring] update ast structure of "ClosureUse", "ConstFetch", "Empty" and "ErrorSuppress" nodes
2020-12-01 11:12:56 +02:00
Vadym Slizov
b90400d993
[refactoring] update ast structure of "BitwiseNot", "BooleanNot", "ClassConstFetch" and "Clone" nodes
2020-12-01 09:51:47 +02:00
Vadym Slizov
4b8d431767
[refactoring] update ast structure of "ArrayDimFetch" and "ArrayItem" nodes
2020-12-01 00:43:03 +02:00
Vadym Slizov
47b974a3a4
[refactoring] update ast structure of "array" and "list" nodes
2020-11-30 23:42:56 +02:00
Vadym Slizov
43f6fab862
[refactoring] update ast structure of "StmtPropertyList", "StmtTraitAdaptationList", "StmtTraitMethodRef" and "StmtTraitUseAlias" nodes
2020-11-29 21:51:46 +02:00
Vadym Slizov
5bd63d90ba
[refactoring] update ast structure of "StmtExpression", "StmtInterface" and "StmtProperty" nodes
2020-11-22 18:54:13 +02:00
Vadym Slizov
2d6ae3a9a2
[refactoring] update ast structure of "ClassMethod", "Function", "ArrowFunction" and "Closure" nodes
2020-11-22 14:26:24 +02:00
Vadym Slizov
4c54c56af5
[refactoring] update ast structure of "ClassExtends", "ClassImplements", "InterfaceExtends", "StmtTraitUse" and "StmtTraitUsePrecedence" nodes
2020-11-22 13:02:36 +02:00
Vadym Slizov
fe2e097d8f
[refactoring] update ast structure of "Class" and "Trait" nodes
2020-11-22 02:03:39 +02:00