[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[pdt-dev] Extending PDT: type inference questions

Hello,

I'm trying to write a custom extension to PDT 2.2 that adds code assistance for
object instantiation for particular framework. I'm following the guidelines at
http://wiki.eclipse.org/Extending_PDT_2.2#Type_inference_hinting and have a
working code for exactly the case from the article:

$myObject = ClassRegistry::init('MyClass');
$myObject->... // A list of methods of MyClass is shown ok

However it seems like the same type inference approach does not work when
not using variable assignment:

ClassRegistry::init('MyClass')->... // No proposals available

Tracing goals evaluation factory for the latter case I found that this
code snippet does not bring up evaluation of any ExpressionTypeGoal goals for
context of the call, but starts with evaluation of MethodElementReturnTypeGoal
that later leads to evaluation of method 'ClassRegistry::init's code.

Attempting to implement evaluation of MethodElementReturnTypeGoal I was
unable to access call context and actual arguments' values. Neither I
succeeded in attempts to obtain MethodReturnTypeGoal object (which has
getArguments() method)


I also tried to utilize code assist strategy via ClassMemberContext. At
first glance it looked promising. However I was unable to find out reciever
class for '->' operator, as ClassMemberContext.getLhsTypes() returns empty
list for the example above.

Albeit I'm actually have access to call context with ClassMemberContext, I'm
not happy with it - as it provides only text of call context via
getStatementText() and it turns out that I have to parse this text manually.

* So, can anybody help me by pointing directions that I should dig further?
* Is there an access from MethodElementReturnTypeGoal to call context or actual
call arguments?
* Why there is no attempt to evaluate goal for call context prior to
goal for method's content?
* Is there a way to access goal evaluator from ClassMemberContext?
* Do I have a broken installation or facing a known bug?


Thank you in advance.

--
Victor Kupriyanov