Search in sources :

Example 1 with TVariable

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

the class ExportedVariableBindingImpl method setDefinedVariable.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setDefinedVariable(TVariable newDefinedVariable) {
    TVariable oldDefinedVariable = definedVariable;
    definedVariable = newDefinedVariable;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, N4JSPackage.EXPORTED_VARIABLE_BINDING__DEFINED_VARIABLE, oldDefinedVariable, definedVariable));
}
Also used : TVariable(org.eclipse.n4js.ts.types.TVariable) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 2 with TVariable

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

the class ExportedVariableDeclarationImpl method setDefinedVariable.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setDefinedVariable(TVariable newDefinedVariable) {
    TVariable oldDefinedVariable = definedVariable;
    definedVariable = newDefinedVariable;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, N4JSPackage.EXPORTED_VARIABLE_DECLARATION__DEFINED_VARIABLE, oldDefinedVariable, definedVariable));
}
Also used : TVariable(org.eclipse.n4js.ts.types.TVariable) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 3 with TVariable

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

the class SymbolOfIdentifierRef method getDeclaration.

@Override
public EObject getDeclaration() {
    VariableDeclaration varDecl = null;
    IdentifiableElement id = ir.getId();
    if (id instanceof TVariable) {
        TVariable tvar = (TVariable) id;
        varDecl = (VariableDeclaration) tvar.getAstElement();
        return varDecl;
    } else {
        // id instanceof VariableDeclaration
        return id;
    }
}
Also used : TVariable(org.eclipse.n4js.ts.types.TVariable) IdentifiableElement(org.eclipse.n4js.ts.types.IdentifiableElement) VariableDeclaration(org.eclipse.n4js.n4JS.VariableDeclaration)

Example 4 with TVariable

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

the class UsedBeforeDeclaredAnalyserFastVersion method visit.

@Override
protected void visit(ControlFlowElement cfe) {
    if (cfe instanceof VariableDeclaration) {
        checkLists.put((VariableDeclaration) cfe, new HashSet<>());
    }
    if (cfe instanceof IdentifierRef) {
        IdentifierRef ir = (IdentifierRef) cfe;
        IdentifiableElement id = ir.getId();
        if (id instanceof TVariable) {
            TVariable tvar = (TVariable) id;
            id = (VariableDeclaration) tvar.getAstElement();
        }
        Set<IdentifierRef> refs = checkLists.get(id);
        if (refs != null) {
            refs.add(ir);
        }
    }
}
Also used : TVariable(org.eclipse.n4js.ts.types.TVariable) IdentifiableElement(org.eclipse.n4js.ts.types.IdentifiableElement) VariableDeclaration(org.eclipse.n4js.n4JS.VariableDeclaration) IdentifierRef(org.eclipse.n4js.n4JS.IdentifierRef)

Example 5 with TVariable

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

the class N4JSResourceDescription method getImportedNames.

@Override
public Iterable<QualifiedName> getImportedNames() {
    if (null == lazyImportedNames) {
        synchronized (this) {
            if (null == lazyImportedNames) {
                // get imported names collected during global scoping
                // the scope provider registers every request in scoping so that by this
                // also all names are collected that cannot be resolved
                Iterable<QualifiedName> superImportedNames = super.getImportedNames();
                // use sorted set to ensure order of items
                final SortedSet<QualifiedName> importedNames;
                if (superImportedNames != null) {
                    importedNames = Sets.newTreeSet(superImportedNames);
                } else {
                    importedNames = Sets.<QualifiedName>newTreeSet();
                }
                // import our own module name to get a proper change notification
                Resource resource = getResource();
                List<EObject> contents = resource.getContents();
                if (contents.size() > 1) {
                    TModule module = (TModule) contents.get(1);
                    importedNames.add(qualifiedNameProvider.getFullyQualifiedName(module));
                }
                final Set<EObject> crossRefTypes = Sets.newHashSet();
                IAcceptor<EObject> acceptor = getCrossRefTypeAcceptor(crossRefTypes);
                crossReferenceComputer.computeCrossRefs(resource, acceptor);
                for (EObject type : crossRefTypes) {
                    if (type instanceof Type) {
                        handleType(importedNames, type);
                    } else if (type instanceof TVariable) {
                        handleTVariable(importedNames, (TVariable) type);
                    } else if (type instanceof TEnumLiteral) {
                        handleTEnumLiteral(importedNames, (TEnumLiteral) type);
                    }
                }
                this.lazyImportedNames = importedNames;
            }
        }
    }
    return lazyImportedNames;
}
Also used : ContainerType(org.eclipse.n4js.ts.types.ContainerType) Type(org.eclipse.n4js.ts.types.Type) TVariable(org.eclipse.n4js.ts.types.TVariable) TEnumLiteral(org.eclipse.n4js.ts.types.TEnumLiteral) QualifiedName(org.eclipse.xtext.naming.QualifiedName) EObject(org.eclipse.emf.ecore.EObject) Resource(org.eclipse.emf.ecore.resource.Resource) TModule(org.eclipse.n4js.ts.types.TModule)

Aggregations

TVariable (org.eclipse.n4js.ts.types.TVariable)10 Type (org.eclipse.n4js.ts.types.Type)5 EObject (org.eclipse.emf.ecore.EObject)4 ContainerType (org.eclipse.n4js.ts.types.ContainerType)3 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)2 Resource (org.eclipse.emf.ecore.resource.Resource)2 VariableDeclaration (org.eclipse.n4js.n4JS.VariableDeclaration)2 IdentifiableElement (org.eclipse.n4js.ts.types.IdentifiableElement)2 TEnumLiteral (org.eclipse.n4js.ts.types.TEnumLiteral)2 TFunction (org.eclipse.n4js.ts.types.TFunction)2 TModule (org.eclipse.n4js.ts.types.TModule)2 LinkedList (java.util.LinkedList)1 URI (org.eclipse.emf.common.util.URI)1 IdentifierRef (org.eclipse.n4js.n4JS.IdentifierRef)1 Script (org.eclipse.n4js.n4JS.Script)1 IN4JSSourceContainer (org.eclipse.n4js.projectModel.IN4JSSourceContainer)1 N4JSResource (org.eclipse.n4js.resource.N4JSResource)1 TypeVisibility (org.eclipse.n4js.scoping.accessModifiers.AbstractTypeVisibilityChecker.TypeVisibility)1 TypeRef (org.eclipse.n4js.ts.typeRefs.TypeRef)1 TField (org.eclipse.n4js.ts.types.TField)1