Skip to content

Commit 582ffd4

Browse files
test: issue-205
1 parent 0df5a49 commit 582ffd4

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

test.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
final abstract class Foo {}

test/snapshot/__snapshots__/byref.test.js.snap

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,76 @@ Program {
803803
}
804804
`;
805805

806+
exports[`byref staticlookup #7 1`] = `
807+
Program {
808+
"children": Array [
809+
ExpressionStatement {
810+
"expression": AssignRef {
811+
"kind": "assignref",
812+
"left": Variable {
813+
"curly": false,
814+
"kind": "variable",
815+
"name": "var",
816+
},
817+
"right": Call {
818+
"arguments": Array [],
819+
"kind": "call",
820+
"what": StaticLookup {
821+
"kind": "staticlookup",
822+
"offset": Identifier {
823+
"kind": "identifier",
824+
"name": "getElementByPath",
825+
},
826+
"what": ParentReference {
827+
"kind": "parentreference",
828+
"raw": "parent",
829+
},
830+
},
831+
},
832+
},
833+
"kind": "expressionstatement",
834+
},
835+
],
836+
"errors": Array [],
837+
"kind": "program",
838+
}
839+
`;
840+
841+
exports[`byref staticlookup #8 1`] = `
842+
Program {
843+
"children": Array [
844+
ExpressionStatement {
845+
"expression": AssignRef {
846+
"kind": "assignref",
847+
"left": Variable {
848+
"curly": false,
849+
"kind": "variable",
850+
"name": "var",
851+
},
852+
"right": Call {
853+
"arguments": Array [],
854+
"kind": "call",
855+
"what": StaticLookup {
856+
"kind": "staticlookup",
857+
"offset": Identifier {
858+
"kind": "identifier",
859+
"name": "getElementByPath",
860+
},
861+
"what": SelfReference {
862+
"kind": "selfreference",
863+
"raw": "self",
864+
},
865+
},
866+
},
867+
},
868+
"kind": "expressionstatement",
869+
},
870+
],
871+
"errors": Array [],
872+
"kind": "program",
873+
}
874+
`;
875+
806876
exports[`byref staticlookup 1`] = `
807877
Program {
808878
"children": Array [

test/snapshot/byref.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ describe('byref', () => {
9191
it('staticlookup #6', () => {
9292
expect(parser.parseEval('$var = &$var::$$$test;')).toMatchSnapshot();
9393
});
94+
it('staticlookup #7', () => {
95+
expect(parser.parseEval('$var = &parent::getElementByPath();')).toMatchSnapshot();
96+
});
97+
it('staticlookup #8', () => {
98+
expect(parser.parseEval(' $var = &self::getElementByPath();')).toMatchSnapshot();
99+
});
94100
// https://github.com/php/php-src/blob/php-7.4.0beta4/Zend/zend_language_parser.y#L1169
95101
it('propertylookup', () => {
96102
expect(parser.parseEval('$var = &$var->test;')).toMatchSnapshot();

0 commit comments

Comments
 (0)