Search in sources :

Example 1 with FieldAccessor

use of org.eclipse.n4js.n4JS.FieldAccessor 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 2 with FieldAccessor

use of org.eclipse.n4js.n4JS.FieldAccessor 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 3 with FieldAccessor

use of org.eclipse.n4js.n4JS.FieldAccessor 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)

Example 4 with FieldAccessor

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

the class PropertyMethodDeclarationImpl 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 FieldAccessor

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

the class FGUtils method isCFContainer.

/**
 * @return true iff the given {@link ControlFlowElement} is a container such as a function's body.
 */
public static boolean isCFContainer(EObject cfe) {
    boolean isScript = cfe instanceof Script;
    boolean isBlock = cfe instanceof Block;
    boolean isExpression = cfe instanceof Expression;
    boolean isBindingPattern = cfe instanceof BindingPattern;
    if (!isScript && !isBlock && !isExpression && !isBindingPattern) {
        return false;
    }
    EObject cfeContainer = cfe.eContainer();
    EObject cfeContainer2 = (cfeContainer == null) ? null : cfeContainer.eContainer();
    boolean containerIsFunctionDeclaration = cfeContainer instanceof FunctionDeclaration;
    boolean containerIsFunctionDefinition = cfeContainer instanceof FunctionDefinition;
    boolean containerIsFieldAccessor = cfeContainer instanceof FieldAccessor;
    boolean containerIsFormalParameter = cfeContainer instanceof FormalParameter;
    boolean containerIsFieldDeclaration = cfeContainer instanceof N4FieldDeclaration;
    boolean containerIsAnnotationArgument = cfeContainer instanceof AnnotationArgument;
    boolean containerIsLiteralOrComputedPropertyName = cfeContainer instanceof LiteralOrComputedPropertyName;
    boolean containerIsExportSpecifier = cfeContainer instanceof ExportSpecifier;
    boolean containerIsExportDeclaration = cfeContainer instanceof ExportDeclaration;
    boolean containerIsN4ClassDefinition = cfeContainer instanceof N4ClassDefinition;
    boolean container2IsN4FieldDeclaration = cfeContainer2 instanceof N4FieldDeclaration;
    boolean isCFContainer = false;
    isCFContainer |= isScript;
    isCFContainer |= isBlock && containerIsFunctionDeclaration;
    isCFContainer |= isBlock && containerIsFunctionDefinition;
    isCFContainer |= isBlock && containerIsFieldAccessor;
    isCFContainer |= isBindingPattern && containerIsFormalParameter;
    isCFContainer |= isExpression && containerIsFormalParameter;
    isCFContainer |= isExpression && containerIsFieldDeclaration;
    isCFContainer |= isExpression && containerIsAnnotationArgument;
    isCFContainer |= isExpression && containerIsLiteralOrComputedPropertyName && container2IsN4FieldDeclaration;
    isCFContainer |= isExpression && containerIsN4ClassDefinition;
    isCFContainer |= isExpression && containerIsExportSpecifier;
    isCFContainer |= isExpression && containerIsExportDeclaration;
    return isCFContainer;
}
Also used : FormalParameter(org.eclipse.n4js.n4JS.FormalParameter) Script(org.eclipse.n4js.n4JS.Script) BindingPattern(org.eclipse.n4js.n4JS.BindingPattern) N4FieldDeclaration(org.eclipse.n4js.n4JS.N4FieldDeclaration) ExportSpecifier(org.eclipse.n4js.n4JS.ExportSpecifier) ExportDeclaration(org.eclipse.n4js.n4JS.ExportDeclaration) FieldAccessor(org.eclipse.n4js.n4JS.FieldAccessor) AnnotationArgument(org.eclipse.n4js.n4JS.AnnotationArgument) N4ClassDefinition(org.eclipse.n4js.n4JS.N4ClassDefinition) FunctionDeclaration(org.eclipse.n4js.n4JS.FunctionDeclaration) Expression(org.eclipse.n4js.n4JS.Expression) EObject(org.eclipse.emf.ecore.EObject) CatchBlock(org.eclipse.n4js.n4JS.CatchBlock) Block(org.eclipse.n4js.n4JS.Block) FunctionDefinition(org.eclipse.n4js.n4JS.FunctionDefinition) LiteralOrComputedPropertyName(org.eclipse.n4js.n4JS.LiteralOrComputedPropertyName)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)5 FieldAccessor (org.eclipse.n4js.n4JS.FieldAccessor)5 FunctionDefinition (org.eclipse.n4js.n4JS.FunctionDefinition)5 InternalEObject (org.eclipse.emf.ecore.InternalEObject)4 FunctionOrFieldAccessor (org.eclipse.n4js.n4JS.FunctionOrFieldAccessor)4 AnnotationArgument (org.eclipse.n4js.n4JS.AnnotationArgument)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 LiteralOrComputedPropertyName (org.eclipse.n4js.n4JS.LiteralOrComputedPropertyName)1 N4ClassDefinition (org.eclipse.n4js.n4JS.N4ClassDefinition)1 N4FieldDeclaration (org.eclipse.n4js.n4JS.N4FieldDeclaration)1 Script (org.eclipse.n4js.n4JS.Script)1