When create DUContexts
David Nolden
zwabel+kde at gmail.com
Sat Jun 14 10:23:27 UTC 2008
Am Samstag, 14. Juni 2008 12:02:28 schrieb Niko Sams:
> //top context
> class A { //context for class
> function foo($i) { //context for params
> //context for method body
> //imports params-context
> }
> }
Yep that's correct
> how about this:
> function foo() {
> if (true) {
> $i = 1;
> }
> echo $i; //prints 1
> }
I don't exactly know php, but in C++ you would create:
- A context for foo parameters
- A context for foo body, which imports parameters
- A context for the condition in the if statement
- A context for the compound statement behind the if statement, that imports
the conditions context
> another example:
> function foo() {
> $a = array(1,2,3);
> foreach ($a as $i) {
> }
> echo $i; //prints 3
> }
Same as with the if statement.
What bothers me more than creating context when it comes to dynamic languages
is the creation of Declarations. You will probably have to create a
Declaration on the first assignment to a name, but will you be able to tell
that declarations type?
Greetings, David
More information about the KDevelop-devel
mailing list