use of org.eclipse.n4js.jsdoc.dom.FullMemberReference in project n4js by eclipse.
the class N4JSDReader method processTag.
private void processTag(Multimap<String, SpecInfo> specInfoByName, RepoRelativePath rrp, Collection<FullMemberReference> testeeRefsFromType, Collection<FullMemberReference> testeeTypeRefsFromType, TMember testMember, boolean isOwnedMember, EObject astElement, Doclet testMethodDoclet, LineTag tag) {
String title = tag.getTitle().getTitle();
if ("testee".equals(title)) {
FullMemberReference ref = getFullMemberRef(tag);
if (ref != null) {
addTestInfoForCodeElement(rrp, testMethodDoclet, ref, testMember, specInfoByName);
}
} else if ("testeeFromType".equals(title)) {
RepoRelativePath rrpTestMethod = isOwnedMember ? rrp : RepoRelativePath.compute(astElement.eResource(), n4jsCore);
for (FullMemberReference ref : testeeRefsFromType) {
addTestInfoForCodeElement(rrpTestMethod, testMethodDoclet, ref, testMember, specInfoByName);
}
} else if ("testeeMember".equals(title)) {
String testeeMember = N4JSDocletParser.TAG_TESTEEMEMBER.getValue(tag, "");
RepoRelativePath rrpTestMethod = isOwnedMember ? rrp : RepoRelativePath.compute(astElement.eResource(), n4jsCore);
for (FullMemberReference testeeTypeRef : testeeTypeRefsFromType) {
FullMemberReference combinedTesteeRef = EcoreUtil.copy(testeeTypeRef);
combinedTesteeRef.setMemberName(testeeMember);
combinedTesteeRef.setRange(tag.getBegin(), tag.getEnd());
addTestInfoForCodeElement(rrpTestMethod, testMethodDoclet, combinedTesteeRef, testMember, specInfoByName);
}
} else if ("reqid".equals(title)) {
String reqid = N4JSDocletParser.TAG_REQID.getValue(tag, "");
if (Strings.isNullOrEmpty(reqid)) {
throw new IllegalStateException("Found reqid tag without requirement ID.");
}
RepoRelativePath rrpTestMethod = isOwnedMember ? rrp : RepoRelativePath.compute(astElement.eResource(), n4jsCore);
addTestInfoForRequirement(rrpTestMethod, testMethodDoclet, reqid, testMember, specInfoByName);
} else {
// should not happen
System.err.println("unhandled referencing tag: " + title);
}
}
use of org.eclipse.n4js.jsdoc.dom.FullMemberReference in project n4js by eclipse.
the class N4JSDReader method processClassifier.
private void processClassifier(Multimap<String, SpecInfo> specInfoByName, Type testType, TClassifier ctype) {
RepoRelativePath rrp = RepoRelativePath.compute(testType.eResource(), n4jsCore);
Doclet testTypeDoclet = n4jsDocHelper.getDoclet(ctype.getAstElement());
Collection<FullMemberReference> testeeRefsFromType = getFullMemberRefsFromType(testTypeDoclet);
Collection<FullMemberReference> testeeTypeRefsFromType = getFullTypeRefsFromType(testTypeDoclet);
MemberList<TMember> allMembers = containerTypesHelper.fromContext(testType).allMembers(ctype, false, false);
for (TMember testMember : allMembers) {
boolean isOwnedMember = testMember.getContainingType() == ctype;
if (testMember instanceof TMethod && AnnotationDefinition.TEST_METHOD.hasAnnotation(testMember)) {
EObject astElement = testMember.getAstElement();
if (!astElement.eIsProxy()) {
Doclet testMethodDoclet = n4jsDocHelper.getDoclet(astElement);
LineTag tag = findLinkToElementTag(testMethodDoclet, isOwnedMember);
if (tag != null) {
processTag(specInfoByName, rrp, testeeRefsFromType, testeeTypeRefsFromType, testMember, isOwnedMember, astElement, testMethodDoclet, tag);
}
} else {
System.err.println("cannot result AST when scanning for doclets: " + astElement);
}
}
}
}
use of org.eclipse.n4js.jsdoc.dom.FullMemberReference in project n4js by eclipse.
the class LineTagWithFullElementReference method parse.
@Override
public Tag parse(TagTitle title, JSDocCharScanner scanner, DescriptionParser descriptionParser) {
FullMemberReference ref = parseReference(scanner, scanner.length());
Tag tag = createLineTag(title);
addValue(tag, REF, ref);
return tag;
}
use of org.eclipse.n4js.jsdoc.dom.FullMemberReference 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