Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » Late resolve problem
Late resolve problem [message #891833] Tue, 26 June 2012 04:31 Go to next message
Steve Petruzza is currently offline Steve Petruzza
Messages: 4
Registered: June 2012
Junior Member
Hi everybody,
I've to use late resolve to get a Struct that is not jet created, I'm doing like this:

var type := outModel->late resolve(DDSTypes::Struct)->any(t | t.name = self.eReferenceType.name)


But I'm getting the following warning: "The result of ''late resolve'' must be assigned to a property or non-local variable to execute as deferred assignment"

And in the end nothing will be resolved...

What I'm doing wrong? What is the right way to do it?
Thanks

[Updated on: Tue, 26 June 2012 04:34]

Report message to a moderator

Re: Late resolve problem [message #891863 is a reply to message #891833] Tue, 26 June 2012 07:16 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4033
Registered: July 2009
Senior Member
Hi

As the message says

"The result of ''late resolve'' must be assigned to a property or
non-local variable to execute as deferred assignment"

"var type" is a local variable.

Regards

Ed Willink

On 26/06/2012 09:31, Steve Petruzza wrote:
> Hi everybody,
> I've to use late resolve to get a Struct that is not jet created, I'm
> doing like this:
>
> var type := outModel->late resolveone(DDSTypes::Struct)->any(t |
> t.name = self.eReferenceType.name);
>
> But I'm getting the following warning: "The result of ''late resolve''
> must be assigned to a property or non-local variable to execute as
> deferred assignment"
>
> And in the end nothing will be resolved...
>
> What I'm doing wrong? What is the right way to do it?
> Thanks
Re: Late resolve problem [message #891877 is a reply to message #891863] Tue, 26 June 2012 08:06 Go to previous messageGo to next message
Steve Petruzza is currently offline Steve Petruzza
Messages: 4
Registered: June 2012
Junior Member
That's right, but also in a property I get the same warning, for example:
object Field{
			type := outModel->late resolve(DDSTypes::Struct)->any(t | t.name = "nameOfMyClass");
		};

[Updated on: Tue, 26 June 2012 08:06]

Report message to a moderator

Re: Late resolve problem [message #891886 is a reply to message #891877] Tue, 26 June 2012 08:36 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4033
Registered: July 2009
Senior Member
Hi

But object Field.type looks suspiciously like a property of a local
variable.

In my experience resolve can be hard to understand, and I'm unclear
whether the problem is mine, the tool's or the specification's.

So I often pass a Dict around through one transformation pass to gather
the information needed for the next. I can understand how a Dict works.

Regards

Ed Willink


On 26/06/2012 13:06, Steve Petruzza wrote:
> That's right, but even in a property I get the same warning, for example:
> object Field{
> type := outModel->late resolve(DDSTypes::Struct)->any(t |
> t.name = "nameOfMyClass");
> };
>
Re: Late resolve problem [message #892380 is a reply to message #891833] Wed, 27 June 2012 19:16 Go to previous message
Alan McMorran is currently offline Alan McMorran
Messages: 55
Registered: July 2009
Member
Steve,

My understanding of the late resolve is that it will wait until the
transformation is complete then go back through and resolve up all the
late resolves that have been deferred. Now I may be incorrect but I
suspect there may be two potential problems here:

1. As Ed has already pointed you're assigning to a local variable which
will, in the execution process, be null/undefined if you try and use it
later in the code so it's giving an error
2. You're running another operation on the late resolved object, in
this case the any function.

I tend to use late resolves to only assign references to objects and
I've not tried having subsequent operations on the resolved object, but
it wouldn't surprise me if the engine didn't deal with this. If you
think about it it would mean that as well as keeping track of the late
resolves it would also have to keep track of the current state of the
mapping at that exact point so it could then call the operation with
whatever variables you refer to. And not just the variables, but their
state at that point since they may have been subsequently modified… I
doubt this would be easy/possible for all conditions

If I need to do this I either alter my mapping order to make sure I can
use a non-late resolve or, if I can't do that and I know the mapping
that will be used, I explicitly call the mapping function.

Of course this is my understanding of how it works, so I may be wrong! :-)

Alan


On 2012-06-26 08:31:48 +0000, Steve Petruzza said:

> Hi everybody,
> I've to use late resolve to get a Struct that is not jet created, I'm
> doing like this:
>
> var type := outModel->late resolveone(DDSTypes::Struct)->any(t | t.name
> = self.eReferenceType.name);
>
> But I'm getting the following warning: "The result of ''late resolve''
> must be assigned to a property or non-local variable to execute as
> deferred assignment"
>
> And in the end nothing will be resolved...
>
> What I'm doing wrong? What is the right way to do it?
> Thanks
Previous Topic:No autocomplete in transformation editor using QVT Operational
Next Topic:AST Creation of QVT-O [SOLVED]
Goto Forum:
  


Current Time: Wed Aug 27 17:14:07 EDT 2014

Powered by FUDForum. Page generated in 0.01801 seconds