Skip to content
This repository has been archived by the owner on Jun 4, 2019. It is now read-only.

No support for local variable in codegraph? #149

Open
wweic opened this issue Aug 13, 2016 · 0 comments
Open

No support for local variable in codegraph? #149

wweic opened this issue Aug 13, 2016 · 0 comments

Comments

@wweic
Copy link

wweic commented Aug 13, 2016

Hi, I'm running codegraph on this dummy code with command:
./codegraph -lang php -build -o "/workspace/tmp" "/php-sample/" .

<?php

namespace Valet;

class Brew
{
    var $cli, $files;

    function installed($formula)
    {
        return in_array($formula, explode($this->cli->run('brew list'.$formula)));
    }

    function foo()
    {
        $a = 1;
        return $a;
    }
}

I have patched pfff to dump the graph.
And I'm seeing such result:

Find these files
    /Users/weichen/php-sample/brew.php

printing all nodes:

[Dir: .]
[Dir: PB]
[Dir: NOT_FOUND]
[Dir: DUPE]
[File: brew.php]
[Class: Valet\Brew]
[Field: Valet\Brew.$cli]
[Field: Valet\Brew.$files]
[Method: Valet\Brew.installed]
[Method: Valet\Brew.foo]
[Function: in_array]
[Function: explode]
[Constant: PHP_EOL]

printing all edges

Method: Valet\Brew.installed uses Field: Valet\Brew.$cli
Method: Valet\Brew.installed uses Function: in_array
Method: Valet\Brew.installed uses Function: explode
Method: Valet\Brew.installed uses Constant: PHP_EOL
nb nodes = 13, nb edges = 4
parse errors = 0
lookup fail = 3
unresolved method calls = 0
(resolved method calls = 0)
unresolved field access = 0
(resolved field access) = 1)
unresolved class access = 0
unresolved calls = 0

I don't see node created for local variable a, is this expected? I'm also reading through documentation . Seems like there was a tool called pfff_browser before which is supposed to have all the features that codegraph should include.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant