When create DUContexts

Niko Sams niko.sams at gmail.com
Sat Jun 14 10:02:28 UTC 2008


Hi!

I currently work on the duchain-part of the php-support for kdevelop4.
As a first step
I write the ContextBuilder class - but not everything is clear to me
when new contexts
should be created - especially as php is a dynamic language.

So far I figured that out: (is it correct?)
//top context
class A {   //context for class
    function foo($i) { //context for params
        //context for method body
        //imports params-context
    }
}

how about this:
function foo() {
    if (true) {
        $i = 1;
    }
    echo $i; //prints 1
}

another example:
function foo() {
    $a = array(1,2,3);
    foreach ($a as $i) {
    }
    echo $i; //prints 3
}

($i isn't a global variable or something)


niko




More information about the KDevelop-devel mailing list