Share
Embed
Life of a Resource (XtextCON 2015)
Sven Efftinge
May 20, 2015
Transcript
30 slides
-
At First There Was Text entity This
{ thisProperty : int op thisOperation(That that) { return that.thatOperation(this) } } entity That { thatProperty : String op thatOperation(This _this) { _this.thisProperty + thatProperty } } -
‘This.dmodel’ EObject EObject EObject node node node node node node
Node Model Concrete Syntax Tree Trace between grammar, text and model -
Install Proxies ‘This.dmodel’ EObject EObject EObject proxy proxy • Container
EObject • EReference • Concrete Text (the node) platform:/resource/my.project/src/This.dmodel#|1 -
class } class } Install Derived State (pre Index) No
index lookup allowed! entity This { thisProperty : int op thisOperation(That that) { return that.thatOperation(this) } } entity That { thatProperty : String op thatOperation(This _this) { _this.thisProperty + thatProperty } } -
class } class } Install Derived State (pre Index) No
index lookup allowed! entity This { thisProperty : int op thisOperation(That that) { return that.thatOperation(this) } } entity That { thatProperty : String op thatOperation(This _this) { _this.thisProperty + thatProperty } } -
Collecting Global Names (aka indexing) Collect all globally visible symbols.
ResourceDescriptionManager.getResourceDescription() entity This { thisProperty : int op thisOperation(That that) { return that.thatOperation(this) } } entity That { thatProperty : String op thatOperation(This _this) { _this.thisProperty + thatProperty } } class } class } -
The Index IResourceDescriptions IResourceDescription (URI) IEObjectDescription IReferenceDescription * * *
Usually indexed on qualifiedName and URI -
entity That { thatProperty : String op thatOperation(This _this) {
_this.thisProperty + thatProperty } } class private String thatProperty public String getThatProperty() { … } public void setThatProperty(String thatProperty) { … } public LAZY_TYPE thatOperation(This _this) { … } } Install Derived State (post! Index) Index lookup allowed! -
Full Resolution entity This { thisProperty : int op thisOperation(That
that) { return that.thatOperation(this) } } Where to find ‘That’? Ask the world (aka index) -
entity This { thisProperty : int op thisOperation(That that) {
return that.thatOperation(this) } } Where to find ‘thatOperation’? Ask ‘That’ (variable type) Full Resolution -
Proxy Resolution ‘This.dmodel’ EObject EObject EObject proxy proxy urceSet ‘That.dmodel’
EObject EObject EObject /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public JvmType getType() { if (type != null && type.eIsProxy()) { InternalEObject oldType = (InternalEObject)type; type = (JvmType)eResolveProxy(oldType); if (type != oldType) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, TypesPackage.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE, oldType, type)); } } return type; } -
‘This.dmodel’ EObject EObject EObject proxy proxy urceSet ‘That.dmodel’ EObject EObject
EObject BasicEObjectImpl#eResolveProxy(..) EcoreUtil#resolve(..) ResourceSet#getResource(URI-part) Resource#getEObject(fragment) Proxy Resolution -
Incremental Build Given 1) Existing Index 2) physically changed URIs
entity This { thisProperty : int op thisOperation(That that) { return that.thatOperation(this) } } entity That { thatProperty : String op thatOperation(This _this) { _this.thisProperty + thatProperty } } Bazz platform:/resource/my.project/src/This.dmodel Change in -
#1 : Create & Load #2 : Pre-Index installDerivedState #3
: create ResourceDescriptionDelta platform:/resource/my.project/src/This.dmodel Affection Analysis IResourceDescription.Manager#isAffected for (allDescriptions) -
#isAffected Is there an outgoing reference? entity This { thisProperty
: int op thisOperation(That that) { return that.thatOperation(this) } } entity That { thatProperty : String op thatOperation(This _this) { _this.thisProperty + thatProperty } } Bazz This Does the delta contain a name, that has been asked for? -
More Specialities • Container Manager • Dirty state • Clustering
• Integration with Java • Exceptions: Active Annotations