File: ast_dump_with_linenos.phpt

package info (click to toggle)
php-ast 1.1.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 632 kB
  • sloc: ansic: 2,173; xml: 621; php: 319; makefile: 2
file content (43 lines) | stat: -rw-r--r-- 796 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
--TEST--
ast_dump() with AST_DUMP_LINENOS
--SKIPIF--
<?php
if (!extension_loaded("ast")) print "skip";
?>
--FILE--
<?php

require __DIR__ . '/../util.php';

$code = <<<'PHP'
<?php
function
test
()
{
    var_dump(
        $foo
    );
}
PHP;

$ast = ast\parse_code($code, $version=70);
echo ast_dump($ast, AST_DUMP_LINENOS);

?>
--EXPECTF--
AST_STMT_LIST @ 1
    0: AST_FUNC_DECL @ 2-9
        name: "test"
        docComment: null
        params: AST_PARAM_LIST @ 4
        stmts: AST_STMT_LIST @ 5
            0: AST_CALL @ 6
                expr: AST_NAME @ 6
                    flags: NAME_NOT_FQ (%d)
                    name: "var_dump"
                args: AST_ARG_LIST @ 7
                    0: AST_VAR @ 7
                        name: "foo"
        returnType: null
        __declId: 0