hasSameSignature method
Check if this method has the same signature as another method
Implementation
bool hasSameSignature(MethodDeclaration other) {
// Check method name
if (getName() != other.getName()) return false;
// Check getter/setter status
if (getIsGetter() != other.getIsGetter()) return false;
if (getIsSetter() != other.getIsSetter()) return false;
// Check parameters
final thisParams = getParameters();
final otherParams = other.getParameters();
if (thisParams.length != otherParams.length) return false;
for (int i = 0; i < thisParams.length; i++) {
final thisParam = thisParams[i];
final otherParam = otherParams[i];
// Check parameter type
if (thisParam.getLinkDeclaration().getName() != otherParam.getLinkDeclaration().getName()) {
return false;
}
// Check parameter name (important for named parameters)
if (thisParam.getName() != otherParam.getName()) {
return false;
}
// Check parameter modifiers
if (thisParam.getIsOptional() != otherParam.getIsOptional()) {
return false;
}
if (thisParam.getIsNamed() != otherParam.getIsNamed()) {
return false;
}
}
return true;
}