Search in sources :

Example 1 with TVersionable

use of org.eclipse.n4js.ts.types.TVersionable in project n4js by eclipse.

the class N4IDLTranspilerUtils method getVersionedInternalName.

/**
 * Returns the internal versioned name of the given {@link NamedImportSpecifier}.
 *
 * This method is aware of aliases. If the specifier does not import a {@link TVersionable} element, this method
 * returns the plain name.
 *
 * @param specifier
 *            The {@link NamedImportSpecifier} to compute the versioned internal name for.
 */
public static String getVersionedInternalName(NamedImportSpecifier specifier) {
    final TExportableElement importedElement = specifier.getImportedElement();
    final String alias = specifier.getAlias();
    final String importedName = null != alias ? alias : importedElement.getExportedName();
    // for non-versionable elements apply
    if (!VersionUtils.isTVersionable(importedElement)) {
        return importedName;
    }
    final int version = ((TVersionable) importedElement).getVersion();
    return getVersionedInternalName(importedName, version);
}
Also used : TVersionable(org.eclipse.n4js.ts.types.TVersionable) TExportableElement(org.eclipse.n4js.ts.types.TExportableElement)

Aggregations

TExportableElement (org.eclipse.n4js.ts.types.TExportableElement)1 TVersionable (org.eclipse.n4js.ts.types.TVersionable)1