use of org.eclipse.n4js.ts.types.TFunction in project n4js by eclipse.
the class FunctionDeclarationImpl method getDefinedFunction.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TFunction getDefinedFunction() {
final Type defType = this.getDefinedType();
TFunction _xifexpression = null;
if ((defType instanceof TFunction)) {
_xifexpression = ((TFunction) defType);
}
return _xifexpression;
}
use of org.eclipse.n4js.ts.types.TFunction in project n4js by eclipse.
the class FunctionTypeExpressionImpl method setDeclaredType.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDeclaredType(TFunction newDeclaredType) {
TFunction oldDeclaredType = declaredType;
declaredType = newDeclaredType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TypeRefsPackage.FUNCTION_TYPE_EXPRESSION__DECLARED_TYPE, oldDeclaredType, declaredType));
}
use of org.eclipse.n4js.ts.types.TFunction in project n4js by eclipse.
the class TFormalParameterImpl method isOptional.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isOptional() {
EList<TFormalParameter> _switchResult = null;
EObject _eContainer = this.eContainer();
boolean _matched = false;
if (_eContainer instanceof TFunction) {
_matched = true;
EObject _eContainer_1 = this.eContainer();
_switchResult = ((TFunction) _eContainer_1).getFpars();
}
if (!_matched) {
if (_eContainer instanceof FunctionTypeExprOrRef) {
_matched = true;
EObject _eContainer_1 = this.eContainer();
_switchResult = ((FunctionTypeExprOrRef) _eContainer_1).getFpars();
}
}
if (!_matched) {
return false;
}
final EList<TFormalParameter> fpars = _switchResult;
for (int i = fpars.indexOf(this); (i >= 0); i--) {
{
final TFormalParameter fpar = fpars.get(i);
if ((fpar.isVariadic() || fpar.isHasInitializerAssignment())) {
return true;
}
}
}
return false;
}
use of org.eclipse.n4js.ts.types.TFunction in project n4js by eclipse.
the class TypeUtils method createConstructorTypeRef.
/**
* Creates new type reference for constructor. if the declared type is TFunction a FunctionTypeRef is created. If
* declared type is TClassifier than TypeTypeRef is created (i.e. <code>constructor{A}</code> in N4JS code)
*/
public static TypeRef createConstructorTypeRef(Type declaredType, TypeArgument... typeArgs) {
TypeRef typeRef = null;
if (declaredType instanceof TFunction) {
// TODO is this correct?
FunctionTypeRef ref = TypeRefsFactory.eINSTANCE.createFunctionTypeRef();
ref.setDeclaredType(declaredType);
for (TypeArgument typeArg : typeArgs) {
ref.getTypeArgs().add(TypeUtils.copyIfContained(typeArg));
}
typeRef = ref;
} else if (declaredType instanceof TClassifier) {
TClassifier tClassifier = (TClassifier) declaredType;
typeRef = createTypeTypeRef(createTypeRef(tClassifier, typeArgs), true);
} else if (declaredType instanceof TypeVariable) {
TypeVariable tTypeVar = (TypeVariable) declaredType;
typeRef = createTypeTypeRef(createTypeRef(tTypeVar), true);
}
return typeRef;
}
use of org.eclipse.n4js.ts.types.TFunction in project n4js by eclipse.
the class PropertyMethodDeclarationImpl method getDefinedFunction.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TFunction getDefinedFunction() {
final Type defType = this.getDefinedType();
TFunction _xifexpression = null;
if ((defType instanceof TFunction)) {
_xifexpression = ((TFunction) defType);
}
return _xifexpression;
}
Aggregations