[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[pdt-dev] Extending PDT: type inference questions
- From: Kooper <victor.kupriyanov@xxxxxxxxx>
- Date: Wed, 29 Dec 2010 16:55:29 +0600
- Delivered-to: firstname.lastname@example.org
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=E7mHbWv7XN6S1N0VYE/32/KxgA8/EskIz65qC9FMq22x1dWlG7DiMKvyTkhNpSsK6/ tP1CQe0OIl731R8zubd5G0aRZnRMeMTk5G4/41/whirBD2lnwNcqaFzPlDWpb2bcLuxR wJV695aB43l7YQ/ZSMFA9g7s780owj77wnZeA=
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
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
* 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.