use of org.eclipse.n4js.n4JS.ImportSpecifier in project n4js by eclipse.
the class OriginAwareScope method getSingleElement.
/**
* Enhanced query-Method marking the originating import as used.
*
* @see org.eclipse.xtext.scoping.IScope#getSingleElement(org.eclipse.xtext.naming.QualifiedName)
*/
@Override
public IEObjectDescription getSingleElement(QualifiedName name) {
IEObjectDescription ret = delegatee.getSingleElement(name);
if (ret == null)
return null;
ImportSpecifier origin = origins.get(ret);
if (origin != null) {
EObject script = EcoreUtil.getRootContainer(origin);
if ((script instanceof Script) && ((Script) script).isFlaggedUsageMarkingFinished()) {
// do nothing as linking phase is over
} else {
// return usage aware description
return getUsageAwareDescription(ret);
}
}
return ret;
}
use of org.eclipse.n4js.n4JS.ImportSpecifier in project n4js by eclipse.
the class N4IDLVersionedImportsTransformation method transformVersionedImportSpecifier.
/**
* Replaces the given versioned import specifier, by multiple named imports.
*
* Only adds new imports for type versions that are actually used in the module.
*/
private void transformVersionedImportSpecifier(VersionedNamedImportSpecifier_IM importSpecifier) {
// determine the type versions that are actually used in this module
Collection<SymbolTableEntryOriginal> typeVersionSTEs = findSymbolTableEntriesForVersionedTypeImport(importSpecifier);
// Add a new named import for each imported type version
typeVersionSTEs.forEach(ste -> {
// remove specifier reference from entry (as we have just removed it from the IM)
ste.setImportSpecifier(null);
// add new import for this specific version
addNamedImport(ste, null);
// obtain newly created specifier via STE
ImportSpecifier createdSpecifier = ste.getImportSpecifier();
// make sure to retain trace of the original IM specifier
getState().tracer.copyTrace(importSpecifier, createdSpecifier);
});
// remove implicitly versioned import from IM
remove(importSpecifier);
}
use of org.eclipse.n4js.n4JS.ImportSpecifier in project n4js by eclipse.
the class SymbolTableEntryOriginalImpl method setImportSpecifier.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setImportSpecifier(ImportSpecifier newImportSpecifier) {
ImportSpecifier oldImportSpecifier = importSpecifier;
importSpecifier = newImportSpecifier;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ImPackage.SYMBOL_TABLE_ENTRY_ORIGINAL__IMPORT_SPECIFIER, oldImportSpecifier, importSpecifier));
}
Aggregations