Implicit definitions (this) are not working
Submitted by Gabriël Konat on 3 May 2013 at 13:35
Issue Log
@guwac: Does the generator support implicit definitions yet?
Yes it does. In C#, the following binding rule
Class(x, m*) : defines unique Class x of type Type(x) scopes Field, Function implicitly defines Field "this" of type Type(x) in m*
generates the following Stratego rules:
nabl-scoping-site = ?Class(x, m*) ; Class( id , nabl-scope(|[NablNsField()]) ) nabl-def-site(child-uris__, sibl-uris__, implicits__|lang__, partition__, uniques__, uri__, states__) = ?Class(x, m*) ; Class( nabl-def( ?c-uri1__ , ?s-uri1__ | lang__ , partition__ , uniques__ , uri__ , uri__ , NablNsClass() , Unique() , Current() , [NablNsField(), NablNsFunction()] ) , id ) ; where(i-2__ := <nabl-def( ?c-uri2__ , ?s-uri2__ | lang__ , partition__ , uniques__ , c-uri1__ , s-uri1__ , NablNsField() , Unique() , [DefScope(m*)] , [] )> "this") ; match(child-uris__|c-uri2__) ; match(sibl-uris__|s-uri2__) ; match(implicits__|[i-2__]) nabl-prop-site(|lang__, partition__, states__, implicits__) = ?Class(x, m*) ; [i-2__] := implicits__ ; Class( nabl-props( | partition__ , [ Prop( Type() , Type(x) , [] ) ] ) , id ) ; where(<nabl-props( | partition__ , [ Prop( Type() , Type(x) , [] ) ] )> i-2__) nabl-import-site(|lang__, partition__, uris__, states__) = ?Class(x, m*) ; nabl-import( | lang__ , partition__ , uris__ , [ Single( "this" , [DefScope(m*)] , [] ) ] )
Handling external definitions with imports might not be the right way here. But that should not be the issue in the master-working branch.
I changed it. External definitions are aliased in
nabl-def
again, not innabl-import
.
The issue is not external definitions, but binding
this
to its enclosing entity definition.
Should it really bind to it, i.e. do you like to ctrl+click
this
and jump to the entity? The current idea was to define a fieldthis
implicitly, which is of the type of the enclosing entity. You cannot ctrl+clickthis
then, because there is no place to jump to. But you can still resolve to the implicit field and get its type.
Log in to post comments