Search in sources :

Example 6 with SymbolTableEntryOriginal

use of org.eclipse.n4js.transpiler.im.SymbolTableEntryOriginal 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);
}
Also used : ImportSpecifier(org.eclipse.n4js.n4JS.ImportSpecifier) SymbolTableEntryOriginal(org.eclipse.n4js.transpiler.im.SymbolTableEntryOriginal)

Example 7 with SymbolTableEntryOriginal

use of org.eclipse.n4js.transpiler.im.SymbolTableEntryOriginal in project n4js by eclipse.

the class ParameterizedPropertyAccessExpression_IMImpl method getPropertyName.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public String getPropertyName() {
    String _xifexpression = null;
    boolean _isAnyPlusAccess = this.isAnyPlusAccess();
    if (_isAnyPlusAccess) {
        _xifexpression = this.getNameOfAnyPlusProperty();
    } else {
        final SymbolTableEntry e = this.getRewiredTarget();
        if ((e instanceof SymbolTableEntryOriginal)) {
            final String exName = ((SymbolTableEntryOriginal) e).exportedName();
            if ((exName != null)) {
                return exName;
            } else {
                SymbolTableEntry _property_IM = this.getProperty_IM();
                String _name = null;
                if (_property_IM != null) {
                    _name = _property_IM.getName();
                }
                return _name;
            }
        } else {
            SymbolTableEntry _property_IM_1 = this.getProperty_IM();
            String _name_1 = null;
            if (_property_IM_1 != null) {
                _name_1 = _property_IM_1.getName();
            }
            return _name_1;
        }
    }
    return _xifexpression;
}
Also used : SymbolTableEntry(org.eclipse.n4js.transpiler.im.SymbolTableEntry) SymbolTableEntryOriginal(org.eclipse.n4js.transpiler.im.SymbolTableEntryOriginal)

Example 8 with SymbolTableEntryOriginal

use of org.eclipse.n4js.transpiler.im.SymbolTableEntryOriginal in project n4js by eclipse.

the class DelegatingGetterDeclarationImpl method setDelegationBaseType.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setDelegationBaseType(SymbolTableEntryOriginal newDelegationBaseType) {
    SymbolTableEntryOriginal oldDelegationBaseType = delegationBaseType;
    delegationBaseType = newDelegationBaseType;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ImPackage.DELEGATING_GETTER_DECLARATION__DELEGATION_BASE_TYPE, oldDelegationBaseType, delegationBaseType));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) SymbolTableEntryOriginal(org.eclipse.n4js.transpiler.im.SymbolTableEntryOriginal)

Example 9 with SymbolTableEntryOriginal

use of org.eclipse.n4js.transpiler.im.SymbolTableEntryOriginal in project n4js by eclipse.

the class DelegatingMethodDeclarationImpl method setDelegationTarget.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setDelegationTarget(SymbolTableEntryOriginal newDelegationTarget) {
    SymbolTableEntryOriginal oldDelegationTarget = delegationTarget;
    delegationTarget = newDelegationTarget;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ImPackage.DELEGATING_METHOD_DECLARATION__DELEGATION_TARGET, oldDelegationTarget, delegationTarget));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) SymbolTableEntryOriginal(org.eclipse.n4js.transpiler.im.SymbolTableEntryOriginal)

Example 10 with SymbolTableEntryOriginal

use of org.eclipse.n4js.transpiler.im.SymbolTableEntryOriginal in project n4js by eclipse.

the class DelegatingMemberImpl method setDelegationTarget.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setDelegationTarget(SymbolTableEntryOriginal newDelegationTarget) {
    SymbolTableEntryOriginal oldDelegationTarget = delegationTarget;
    delegationTarget = newDelegationTarget;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ImPackage.DELEGATING_MEMBER__DELEGATION_TARGET, oldDelegationTarget, delegationTarget));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) SymbolTableEntryOriginal(org.eclipse.n4js.transpiler.im.SymbolTableEntryOriginal)

Aggregations

SymbolTableEntryOriginal (org.eclipse.n4js.transpiler.im.SymbolTableEntryOriginal)11 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)8 SymbolTableEntry (org.eclipse.n4js.transpiler.im.SymbolTableEntry)2 ImportSpecifier (org.eclipse.n4js.n4JS.ImportSpecifier)1