use of org.eclipse.n4js.ts.types.Type in project n4js by eclipse.
the class N4JSDReader method getRealTopLevelTypes.
/**
* The method {@link TModule#getTopLevelTypes()} returns also functions that are nested in functions. These are
* filtered out in this method.
*
* @return real top level types
*/
private Collection<Type> getRealTopLevelTypes(Script script) {
Collection<Type> realTLT = new LinkedList<>();
for (Type tlt : script.getModule().getTopLevelTypes()) {
if (tlt instanceof SyntaxRelatedTElement) {
SyntaxRelatedTElement srte = (SyntaxRelatedTElement) tlt;
EObject astElem = srte.getAstElement();
astElem = astElem != null ? astElem.eContainer() : null;
FunctionOrFieldAccessor fofa = EcoreUtil2.getContainerOfType(astElem, FunctionOrFieldAccessor.class);
if (fofa != null) {
continue;
}
}
realTLT.add(tlt);
}
return realTLT;
}
use of org.eclipse.n4js.ts.types.Type in project n4js by eclipse.
the class SpecModuleFile method ensureNewContent.
private String ensureNewContent() {
if (newContent != null)
return newContent;
StringBuilder strb = new StringBuilder();
int startline = 1;
startline = generateModuleHeader(strb, startline);
startline = generateVariableSection(strb, startline);
startline = generateFunctionSection(strb, startline);
for (Iterator<Type> it = types.iterator(); it.hasNext(); ) {
Type type = it.next();
startline = generateTypeSection(strb, startline, type);
}
newContent = strb.toString();
return newContent;
}
use of org.eclipse.n4js.ts.types.Type in project n4js by eclipse.
the class SpecModuleFile method add.
/**
* Adds another region change entry to this file.
*/
@Override
public void add(SpecSection specElem) {
if (!(specElem instanceof SpecIdentifiableElementSection))
return;
SpecIdentifiableElementSection specIE = (SpecIdentifiableElementSection) specElem;
EObject container = specIE.idElement.eContainer();
if (container instanceof Type) {
addTypeElement((Type) container, specIE);
return;
}
if (specIE.idElement instanceof TFunction) {
functions.add(specIE);
allSections.add(specIE);
return;
}
if (specIE.idElement instanceof TVariable) {
variables.add(specIE);
allSections.add(specIE);
return;
}
if (specIE.idElement instanceof Type) {
addTypeElement((Type) specIE.idElement, specIE);
return;
}
throw new RuntimeException("Missing Implementation");
}
use of org.eclipse.n4js.ts.types.Type in project n4js by eclipse.
the class LineTagWithFullElementReference method createReferenceFromType.
@SuppressWarnings("javadoc")
public static FullMemberReference createReferenceFromType(TMember member) {
FullMemberReference ref = DomFactory.eINSTANCE.createFullMemberReference();
Type type = member.getContainingType();
ref.setRange(-1, -1);
ref.setModuleName(type.getContainingModule().getModuleSpecifier());
ref.setTypeName(type.getName());
ref.setStaticMember(member.isStatic());
ref.setMemberName(member.getName());
return ref;
}
Aggregations