Search in sources :

Example 1 with FunctionDefinition

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

the class NullUndefinedValidator method getParentScope.

private EObject getParentScope(EObject eobj) {
    Iterable<EObject> containers = EcoreUtil2.getAllContainers(eobj);
    for (EObject container : containers) {
        boolean isScopeParent = false;
        isScopeParent |= container instanceof FunctionDefinition;
        isScopeParent |= container instanceof FunctionExpression;
        if (isScopeParent) {
            return container;
        }
    }
    return null;
}
Also used : FunctionExpression(org.eclipse.n4js.n4JS.FunctionExpression) EObject(org.eclipse.emf.ecore.EObject) FunctionDefinition(org.eclipse.n4js.n4JS.FunctionDefinition)

Example 2 with FunctionDefinition

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

the class N4MethodDeclarationImpl method getDefinedFunctionOrAccessor.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IdentifiableElement getDefinedFunctionOrAccessor() {
    final FunctionOrFieldAccessor _this = this;
    EObject _switchResult = null;
    boolean _matched = false;
    if (_this instanceof FunctionDefinition) {
        _matched = true;
        _switchResult = ((FunctionDefinition) _this).getDefinedType();
    }
    if (!_matched) {
        if (_this instanceof FieldAccessor) {
            _matched = true;
            _switchResult = ((FieldAccessor) _this).getDefinedAccessor();
        }
    }
    return ((IdentifiableElement) _switchResult);
}
Also used : FunctionOrFieldAccessor(org.eclipse.n4js.n4JS.FunctionOrFieldAccessor) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) FunctionDefinition(org.eclipse.n4js.n4JS.FunctionDefinition) FunctionOrFieldAccessor(org.eclipse.n4js.n4JS.FunctionOrFieldAccessor) FieldAccessor(org.eclipse.n4js.n4JS.FieldAccessor)

Example 3 with FunctionDefinition

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

the class N4FieldAccessorImpl method getDefinedFunctionOrAccessor.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IdentifiableElement getDefinedFunctionOrAccessor() {
    final FunctionOrFieldAccessor _this = this;
    EObject _switchResult = null;
    boolean _matched = false;
    if (_this instanceof FunctionDefinition) {
        _matched = true;
        _switchResult = ((FunctionDefinition) _this).getDefinedType();
    }
    if (!_matched) {
        if (_this instanceof org.eclipse.n4js.n4JS.FieldAccessor) {
            _matched = true;
            _switchResult = ((org.eclipse.n4js.n4JS.FieldAccessor) _this).getDefinedAccessor();
        }
    }
    return ((IdentifiableElement) _switchResult);
}
Also used : FunctionOrFieldAccessor(org.eclipse.n4js.n4JS.FunctionOrFieldAccessor) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) FunctionDefinition(org.eclipse.n4js.n4JS.FunctionDefinition) FunctionOrFieldAccessor(org.eclipse.n4js.n4JS.FunctionOrFieldAccessor) FieldAccessor(org.eclipse.n4js.ts.types.FieldAccessor) N4FieldAccessor(org.eclipse.n4js.n4JS.N4FieldAccessor)

Example 4 with FunctionDefinition

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

the class FunctionDeclarationImpl method getDefinedFunctionOrAccessor.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IdentifiableElement getDefinedFunctionOrAccessor() {
    final FunctionOrFieldAccessor _this = this;
    EObject _switchResult = null;
    boolean _matched = false;
    if (_this instanceof FunctionDefinition) {
        _matched = true;
        _switchResult = ((FunctionDefinition) _this).getDefinedType();
    }
    if (!_matched) {
        if (_this instanceof FieldAccessor) {
            _matched = true;
            _switchResult = ((FieldAccessor) _this).getDefinedAccessor();
        }
    }
    return ((IdentifiableElement) _switchResult);
}
Also used : FunctionOrFieldAccessor(org.eclipse.n4js.n4JS.FunctionOrFieldAccessor) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) FunctionDefinition(org.eclipse.n4js.n4JS.FunctionDefinition) FunctionOrFieldAccessor(org.eclipse.n4js.n4JS.FunctionOrFieldAccessor) FieldAccessor(org.eclipse.n4js.n4JS.FieldAccessor)

Example 5 with FunctionDefinition

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

the class FunctionOrFieldAccessorImpl method getDefinedFunctionOrAccessor.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IdentifiableElement getDefinedFunctionOrAccessor() {
    final FunctionOrFieldAccessor _this = this;
    EObject _switchResult = null;
    boolean _matched = false;
    if (_this instanceof FunctionDefinition) {
        _matched = true;
        _switchResult = ((FunctionDefinition) _this).getDefinedType();
    }
    if (!_matched) {
        if (_this instanceof FieldAccessor) {
            _matched = true;
            _switchResult = ((FieldAccessor) _this).getDefinedAccessor();
        }
    }
    return ((IdentifiableElement) _switchResult);
}
Also used : FunctionOrFieldAccessor(org.eclipse.n4js.n4JS.FunctionOrFieldAccessor) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) FunctionDefinition(org.eclipse.n4js.n4JS.FunctionDefinition) FunctionOrFieldAccessor(org.eclipse.n4js.n4JS.FunctionOrFieldAccessor) FieldAccessor(org.eclipse.n4js.n4JS.FieldAccessor)

Aggregations

FunctionDefinition (org.eclipse.n4js.n4JS.FunctionDefinition)9 EObject (org.eclipse.emf.ecore.EObject)7 FunctionOrFieldAccessor (org.eclipse.n4js.n4JS.FunctionOrFieldAccessor)6 InternalEObject (org.eclipse.emf.ecore.InternalEObject)5 FieldAccessor (org.eclipse.n4js.n4JS.FieldAccessor)5 N4FieldDeclaration (org.eclipse.n4js.n4JS.N4FieldDeclaration)2 AnnotationArgument (org.eclipse.n4js.n4JS.AnnotationArgument)1 ArrowFunction (org.eclipse.n4js.n4JS.ArrowFunction)1 BindingPattern (org.eclipse.n4js.n4JS.BindingPattern)1 Block (org.eclipse.n4js.n4JS.Block)1 CatchBlock (org.eclipse.n4js.n4JS.CatchBlock)1 ExportDeclaration (org.eclipse.n4js.n4JS.ExportDeclaration)1 ExportSpecifier (org.eclipse.n4js.n4JS.ExportSpecifier)1 Expression (org.eclipse.n4js.n4JS.Expression)1 FormalParameter (org.eclipse.n4js.n4JS.FormalParameter)1 FunctionDeclaration (org.eclipse.n4js.n4JS.FunctionDeclaration)1 FunctionExpression (org.eclipse.n4js.n4JS.FunctionExpression)1 IdentifierRef (org.eclipse.n4js.n4JS.IdentifierRef)1 LiteralOrComputedPropertyName (org.eclipse.n4js.n4JS.LiteralOrComputedPropertyName)1 N4ClassDeclaration (org.eclipse.n4js.n4JS.N4ClassDeclaration)1