Search in sources :

Example 6 with SyntaxRelatedTElement

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

the class N4JSDReader method getRealTopLevelTypes.

/**
 * The method {@link TModule#getTopLevelTypes()} returns also functions that are nested in functions. These are
 * filtered out in this method.
 *
 * @return real top level types
 */
private Collection<Type> getRealTopLevelTypes(Script script) {
    Collection<Type> realTLT = new LinkedList<>();
    for (Type tlt : script.getModule().getTopLevelTypes()) {
        if (tlt instanceof SyntaxRelatedTElement) {
            SyntaxRelatedTElement srte = (SyntaxRelatedTElement) tlt;
            EObject astElem = srte.getAstElement();
            astElem = astElem != null ? astElem.eContainer() : null;
            FunctionOrFieldAccessor fofa = EcoreUtil2.getContainerOfType(astElem, FunctionOrFieldAccessor.class);
            if (fofa != null) {
                continue;
            }
        }
        realTLT.add(tlt);
    }
    return realTLT;
}
Also used : ContainerType(org.eclipse.n4js.ts.types.ContainerType) Type(org.eclipse.n4js.ts.types.Type) FunctionOrFieldAccessor(org.eclipse.n4js.n4JS.FunctionOrFieldAccessor) SyntaxRelatedTElement(org.eclipse.n4js.ts.types.SyntaxRelatedTElement) EObject(org.eclipse.emf.ecore.EObject) LinkedList(java.util.LinkedList)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)6 SyntaxRelatedTElement (org.eclipse.n4js.ts.types.SyntaxRelatedTElement)6 URI (org.eclipse.emf.common.util.URI)2 InternalEObject (org.eclipse.emf.ecore.InternalEObject)2 LinkedList (java.util.LinkedList)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)1 FunctionOrFieldAccessor (org.eclipse.n4js.n4JS.FunctionOrFieldAccessor)1 ContainerType (org.eclipse.n4js.ts.types.ContainerType)1 Type (org.eclipse.n4js.ts.types.Type)1 ICompositeNode (org.eclipse.xtext.nodemodel.ICompositeNode)1 INode (org.eclipse.xtext.nodemodel.INode)1 XtextHyperlink (org.eclipse.xtext.ui.editor.hyperlinking.XtextHyperlink)1