use of dyvilx.tools.compiler.ast.member.IClassMember in project Dyvil by Dyvil.
the class StatementList method addMethod.
protected void addMethod(MemberStatement memberStatement, MarkerList markers) {
final IClassMember member = memberStatement.member;
final MemberKind memberKind = member.getKind();
if (memberKind != MemberKind.METHOD) {
markers.add(Markers.semantic(member.getPosition(), "statementlist.declaration.invalid", Util.memberNamed(member)));
return;
}
final IMethod method = (IMethod) member;
if (this.methods == null) {
this.methods = new ArrayList<>();
this.methods.add(method);
return;
}
final Name methodName = method.getName();
final int parameterCount = method.getParameters().size();
final String desc = method.getDescriptor();
for (IMethod candidate : this.methods) {
if (// same name
candidate.getName() == methodName && candidate.getParameters().size() == parameterCount && candidate.getDescriptor().equals(desc)) {
markers.add(Markers.semanticError(memberStatement.getPosition(), "method.duplicate", methodName, desc));
}
}
this.methods.add(method);
}
Aggregations