Search in sources :

Example 1 with ExportableElement

use of org.eclipse.n4js.n4JS.ExportableElement in project n4js by eclipse.

the class FunctionDeclarationImpl method getExportedName.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public String getExportedName() {
    boolean _isExported = this.isExported();
    if (_isExported) {
        EObject _eContainer = this.eContainer();
        final ExportDeclaration exportDecl = ((ExportDeclaration) _eContainer);
        boolean _isDefaultExport = exportDecl.isDefaultExport();
        if (_isDefaultExport) {
            return "default";
        }
        final ExportableElement me = this;
        String _switchResult = null;
        boolean _matched = false;
        if (me instanceof NamedElement) {
            _matched = true;
            _switchResult = ((NamedElement) me).getName();
        }
        if (!_matched) {
            if (me instanceof IdentifiableElement) {
                _matched = true;
                _switchResult = ((IdentifiableElement) me).getName();
            }
        }
        return _switchResult;
    }
    return null;
}
Also used : ExportableElement(org.eclipse.n4js.n4JS.ExportableElement) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) IdentifiableElement(org.eclipse.n4js.ts.types.IdentifiableElement) ExportDeclaration(org.eclipse.n4js.n4JS.ExportDeclaration) NamedElement(org.eclipse.n4js.n4JS.NamedElement)

Example 2 with ExportableElement

use of org.eclipse.n4js.n4JS.ExportableElement in project n4js by eclipse.

the class ExportedVariableStatementImpl method getExportedName.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public String getExportedName() {
    boolean _isExported = this.isExported();
    if (_isExported) {
        EObject _eContainer = this.eContainer();
        final ExportDeclaration exportDecl = ((ExportDeclaration) _eContainer);
        boolean _isDefaultExport = exportDecl.isDefaultExport();
        if (_isDefaultExport) {
            return "default";
        }
        final ExportableElement me = this;
        String _switchResult = null;
        boolean _matched = false;
        if (me instanceof NamedElement) {
            _matched = true;
            _switchResult = ((NamedElement) me).getName();
        }
        if (!_matched) {
            if (me instanceof IdentifiableElement) {
                _matched = true;
                _switchResult = ((IdentifiableElement) me).getName();
            }
        }
        return _switchResult;
    }
    return null;
}
Also used : ExportableElement(org.eclipse.n4js.n4JS.ExportableElement) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) IdentifiableElement(org.eclipse.n4js.ts.types.IdentifiableElement) ExportDeclaration(org.eclipse.n4js.n4JS.ExportDeclaration) NamedElement(org.eclipse.n4js.n4JS.NamedElement)

Example 3 with ExportableElement

use of org.eclipse.n4js.n4JS.ExportableElement in project n4js by eclipse.

the class AnnotationListImpl method getExportedName.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public String getExportedName() {
    boolean _isExported = this.isExported();
    if (_isExported) {
        EObject _eContainer = this.eContainer();
        final ExportDeclaration exportDecl = ((ExportDeclaration) _eContainer);
        boolean _isDefaultExport = exportDecl.isDefaultExport();
        if (_isDefaultExport) {
            return "default";
        }
        final ExportableElement me = this;
        String _switchResult = null;
        boolean _matched = false;
        if (me instanceof NamedElement) {
            _matched = true;
            _switchResult = ((NamedElement) me).getName();
        }
        if (!_matched) {
            if (me instanceof IdentifiableElement) {
                _matched = true;
                _switchResult = ((IdentifiableElement) me).getName();
            }
        }
        return _switchResult;
    }
    return null;
}
Also used : ExportableElement(org.eclipse.n4js.n4JS.ExportableElement) EObject(org.eclipse.emf.ecore.EObject) IdentifiableElement(org.eclipse.n4js.ts.types.IdentifiableElement) ExportDeclaration(org.eclipse.n4js.n4JS.ExportDeclaration) NamedElement(org.eclipse.n4js.n4JS.NamedElement)

Example 4 with ExportableElement

use of org.eclipse.n4js.n4JS.ExportableElement in project n4js by eclipse.

the class ExportableElementImpl method getExportedName.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public String getExportedName() {
    boolean _isExported = this.isExported();
    if (_isExported) {
        EObject _eContainer = this.eContainer();
        final ExportDeclaration exportDecl = ((ExportDeclaration) _eContainer);
        boolean _isDefaultExport = exportDecl.isDefaultExport();
        if (_isDefaultExport) {
            return "default";
        }
        final ExportableElement me = this;
        String _switchResult = null;
        boolean _matched = false;
        if (me instanceof NamedElement) {
            _matched = true;
            _switchResult = ((NamedElement) me).getName();
        }
        if (!_matched) {
            if (me instanceof IdentifiableElement) {
                _matched = true;
                _switchResult = ((IdentifiableElement) me).getName();
            }
        }
        return _switchResult;
    }
    return null;
}
Also used : ExportableElement(org.eclipse.n4js.n4JS.ExportableElement) EObject(org.eclipse.emf.ecore.EObject) IdentifiableElement(org.eclipse.n4js.ts.types.IdentifiableElement) ExportDeclaration(org.eclipse.n4js.n4JS.ExportDeclaration) NamedElement(org.eclipse.n4js.n4JS.NamedElement)

Example 5 with ExportableElement

use of org.eclipse.n4js.n4JS.ExportableElement in project n4js by eclipse.

the class ScriptFactory method getScriptElementAt.

private static ScriptElement getScriptElementAt(Script script, int i) {
    EList<ScriptElement> scriptElems = script.getScriptElements();
    ScriptElement scriptElement = scriptElems.get(i);
    if (scriptElement instanceof ExportDeclaration) {
        ExportableElement expElem = ((ExportDeclaration) scriptElement).getExportedElement();
        if (expElem instanceof ExportedVariableStatement) {
            scriptElement = (ExportedVariableStatement) expElem;
        }
    }
    return scriptElement;
}
Also used : ExportableElement(org.eclipse.n4js.n4JS.ExportableElement) ScriptElement(org.eclipse.n4js.n4JS.ScriptElement) ExportDeclaration(org.eclipse.n4js.n4JS.ExportDeclaration) ExportedVariableStatement(org.eclipse.n4js.n4JS.ExportedVariableStatement)

Aggregations

ExportableElement (org.eclipse.n4js.n4JS.ExportableElement)9 ExportDeclaration (org.eclipse.n4js.n4JS.ExportDeclaration)8 EObject (org.eclipse.emf.ecore.EObject)7 NamedElement (org.eclipse.n4js.n4JS.NamedElement)6 IdentifiableElement (org.eclipse.n4js.ts.types.IdentifiableElement)6 InternalEObject (org.eclipse.emf.ecore.InternalEObject)4 ExportedVariableStatement (org.eclipse.n4js.n4JS.ExportedVariableStatement)2 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 ExportedVariableDeclaration (org.eclipse.n4js.n4JS.ExportedVariableDeclaration)1 ScriptElement (org.eclipse.n4js.n4JS.ScriptElement)1 VariableDeclaration (org.eclipse.n4js.n4JS.VariableDeclaration)1 TypeRef (org.eclipse.n4js.ts.typeRefs.TypeRef)1 ICompositeNode (org.eclipse.xtext.nodemodel.ICompositeNode)1 INode (org.eclipse.xtext.nodemodel.INode)1 LeafNode (org.eclipse.xtext.nodemodel.impl.LeafNode)1