use of org.eclipse.n4js.ts.types.TFormalParameter in project n4js by eclipse.
the class TMethodImpl method getFunctionAsString.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getFunctionAsString() {
final StringBuilder strb = new StringBuilder();
boolean _isGeneric = this.isGeneric();
if (_isGeneric) {
final Function1<TypeVariable, String> _function = new Function1<TypeVariable, String>() {
public String apply(final TypeVariable it) {
return it.getTypeAsString();
}
};
strb.append("<").append(IterableExtensions.join(XcoreEListExtensions.<TypeVariable, String>map(this.getTypeVars(), _function), ",")).append("> ");
}
boolean _isDeclaredAsync = this.isDeclaredAsync();
if (_isDeclaredAsync) {
strb.append("async ");
}
final Function1<TFormalParameter, String> _function_1 = new Function1<TFormalParameter, String>() {
public String apply(final TFormalParameter it) {
return it.getFormalParameterAsString();
}
};
strb.append(this.getName()).append("(").append(IterableExtensions.join(XcoreEListExtensions.<TFormalParameter, String>map(this.getFpars(), _function_1), ", ")).append(")");
TypeRef _returnTypeRef = this.getReturnTypeRef();
boolean _tripleNotEquals = (_returnTypeRef != null);
if (_tripleNotEquals) {
strb.append(": ").append(this.getReturnTypeRef().getTypeRefAsString());
}
boolean _isReturnValueOptional = this.isReturnValueOptional();
if (_isReturnValueOptional) {
strb.append("?");
}
return strb.toString();
}
use of org.eclipse.n4js.ts.types.TFormalParameter in project n4js by eclipse.
the class TSetterImpl method getMemberAsString.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getMemberAsString() {
String _name = this.getName();
String _plus = ("set " + _name);
String _xifexpression = null;
boolean _isOptional = this.isOptional();
if (_isOptional) {
_xifexpression = "?";
} else {
_xifexpression = "";
}
String _plus_1 = (_plus + _xifexpression);
String _plus_2 = (_plus_1 + "(");
TFormalParameter _fpar = this.getFpar();
String _formalParameterAsString = null;
if (_fpar != null) {
_formalParameterAsString = _fpar.getFormalParameterAsString();
}
String _plus_3 = (_plus_2 + _formalParameterAsString);
return (_plus_3 + ")");
}
use of org.eclipse.n4js.ts.types.TFormalParameter 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.TFormalParameter in project n4js by eclipse.
the class TFunctionImpl method getFunctionAsString.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getFunctionAsString() {
final StringBuilder strb = new StringBuilder();
boolean _isGeneric = this.isGeneric();
if (_isGeneric) {
final Function1<TypeVariable, String> _function = new Function1<TypeVariable, String>() {
public String apply(final TypeVariable it) {
return it.getTypeAsString();
}
};
strb.append("<").append(IterableExtensions.join(XcoreEListExtensions.<TypeVariable, String>map(this.getTypeVars(), _function), ",")).append("> ");
}
boolean _isDeclaredAsync = this.isDeclaredAsync();
if (_isDeclaredAsync) {
strb.append("async ");
}
strb.append("function ");
boolean _isDeclaredGenerator = this.isDeclaredGenerator();
if (_isDeclaredGenerator) {
strb.append("* ");
}
final Function1<TFormalParameter, String> _function_1 = new Function1<TFormalParameter, String>() {
public String apply(final TFormalParameter it) {
return it.getFormalParameterAsString();
}
};
strb.append(this.getName()).append("(").append(IterableExtensions.join(XcoreEListExtensions.<TFormalParameter, String>map(this.getFpars(), _function_1), ", ")).append(")");
TypeRef _returnTypeRef = this.getReturnTypeRef();
boolean _tripleNotEquals = (_returnTypeRef != null);
if (_tripleNotEquals) {
strb.append(": ").append(this.getReturnTypeRef().getTypeRefAsString());
}
boolean _isReturnValueOptional = this.isReturnValueOptional();
if (_isReturnValueOptional) {
strb.append("?");
}
return strb.toString();
}
use of org.eclipse.n4js.ts.types.TFormalParameter in project n4js by eclipse.
the class VersionedFunctionTypeRefImpl method getTypeRefAsString.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getTypeRefAsString() {
String _xifexpression = null;
TypeRef _declaredThisType = this.getDeclaredThisType();
boolean _tripleNotEquals = (_declaredThisType != null);
if (_tripleNotEquals) {
String _typeRefAsString = this.getDeclaredThisType().getTypeRefAsString();
String _plus = ("@This(" + _typeRefAsString);
_xifexpression = (_plus + ") ");
} else {
_xifexpression = "";
}
String _plus_1 = ("{" + _xifexpression);
String _plus_2 = (_plus_1 + "function");
String _xifexpression_1 = null;
boolean _isGeneric = this.isGeneric();
if (_isGeneric) {
final Function1<TypeVariable, String> _function = new Function1<TypeVariable, String>() {
public String apply(final TypeVariable it) {
return it.getTypeVariableAsString(VersionedFunctionTypeRefImpl.this.getTypeVarUpperBound(it));
}
};
String _join = IterableExtensions.join(XcoreEListExtensions.<TypeVariable, String>map(this.getTypeVars(), _function), ",");
String _plus_3 = ("<" + _join);
_xifexpression_1 = (_plus_3 + ">");
} else {
_xifexpression_1 = "";
}
String _plus_4 = (_plus_2 + _xifexpression_1);
String _plus_5 = (_plus_4 + "(");
final Function1<TFormalParameter, String> _function_1 = new Function1<TFormalParameter, String>() {
public String apply(final TFormalParameter it) {
return it.getFormalParameterAsTypesString();
}
};
String _join_1 = IterableExtensions.join(XcoreEListExtensions.<TFormalParameter, String>map(this.getFpars(), _function_1), ",");
String _plus_6 = (_plus_5 + _join_1);
String _plus_7 = (_plus_6 + ")");
String _xifexpression_2 = null;
TypeRef _returnTypeRef = this.getReturnTypeRef();
boolean _tripleNotEquals_1 = (_returnTypeRef != null);
if (_tripleNotEquals_1) {
String _typeRefAsString_1 = this.getReturnTypeRef().getTypeRefAsString();
_xifexpression_2 = (":" + _typeRefAsString_1);
} else {
_xifexpression_2 = "";
}
String _plus_8 = (_plus_7 + _xifexpression_2);
String _xifexpression_3 = null;
boolean _isReturnValueOptional = this.isReturnValueOptional();
if (_isReturnValueOptional) {
_xifexpression_3 = "?";
} else {
_xifexpression_3 = "";
}
String _plus_9 = (_plus_8 + _xifexpression_3);
String _plus_10 = (_plus_9 + "}");
String _modifiersAsString = this.getModifiersAsString();
return (_plus_10 + _modifiersAsString);
}
Aggregations