Skip to content

Commit bf9c42e

Browse files
committed
Add doc strings and improve naming.
1 parent fe24189 commit bf9c42e

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

libsolidity/analysis/TypeChecker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3171,7 +3171,7 @@ void TypeChecker::validateAccessMemberFunctionType(
31713171
Type const* _expressionObjectType,
31723172
ASTString const& _memberName,
31733173
SourceLocation const& _location,
3174-
bool _emptyArguments,
3174+
bool _hasEmptyArguments,
31753175
bool _isDefined
31763176
) const
31773177
{
@@ -3196,7 +3196,7 @@ void TypeChecker::validateAccessMemberFunctionType(
31963196

31973197
if (
31983198
_accessedMemberFunctionType->kind() == FunctionType::Kind::ArrayPush &&
3199-
!_emptyArguments &&
3199+
!_hasEmptyArguments &&
32003200
_expressionObjectType->containsNestedMapping()
32013201
)
32023202
m_errorReporter.typeError(

libsolidity/analysis/TypeChecker.h

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,29 +189,53 @@ class TypeChecker: private ASTConstVisitor
189189
return m_currentSourceUnit;
190190
}
191191

192+
/// MemberAccess visitor helpers:
193+
///
194+
/// Resolves overloaded functions by filtering out inapplicable candidates based on the provided arguments
195+
/// and the object type of the expression. This process ensures that only valid functions from the given set
196+
/// of possible members remain, based on argument compatibility and type constraints.
197+
/// @param _expressionObjectType The type of the object on which the member function is invoked.
198+
/// @param _possibleMembers A map of possible member functions of the object. This map will be modified in-place,
199+
/// removing members that do not match the provided arguments or object type.
200+
/// @param _arguments The list of arguments provided in the function call, used to validate compatibility with
201+
/// candidate members.
192202
void performOverloadedResolution(
193203
Type const* _expressionObjectType,
194204
MemberList::MemberMap& _possibleMembers,
195205
FuncCallArguments const& _arguments
196206
) const;
197207

208+
/// Handles errors related to accessing unresolved members.
209+
/// Collects and processes errors for member access operations where the member could not be resolved.
210+
/// @param _memberAccess The member access expression where the unresolved member access occurred.
211+
/// @param _expressionObjectType The type of the object being accessed.
212+
/// @param _memberName The name of the member that could not be resolved.
213+
/// @param _possibleMemberCountBeforeOverloading The initial count of possible members before overloading resolution.
198214
void handleUnresolvedMemberAccessErrors(
199215
MemberAccess const& _memberAccess,
200216
Type const* _expressionObjectType,
201217
ASTString const& _memberName,
202-
size_t _initialMemberCount
218+
size_t _possibleMemberCountBeforeOverloading
203219
) const;
204220

221+
/// Validates access to a member function of a given type, ensuring that the invocation
222+
/// is consistent with the expected types and semantics. Reports errors and warnings
223+
/// for invalid access, use of deprecated features, and unsupported operations.
224+
/// @param _accessedMemberFunctionType The type of the member function that is being accessed.
225+
/// @param _expressionObjectType The type of the object on which the member function is accessed.
226+
/// @param _memberName The name of the member function being accessed.
227+
/// @param _location The source location where the member function is accessed.
228+
/// @param _hasEmptyArguments Indicates whether the member function is accessed without arguments.
229+
/// @param _isDefined Specifies if the member function is fully defined or abstract.
205230
void validateAccessMemberFunctionType(
206231
FunctionType const* _accessedMemberFunctionType,
207232
Type const* _expressionObjectType,
208233
ASTString const& _memberName,
209234
langutil::SourceLocation const& _location,
210-
bool _emptyArguments,
235+
bool _hasEmptyArguments,
211236
bool _isDefined
212237
) const;
213238

214-
215239
SourceUnit const* m_currentSourceUnit = nullptr;
216240
ContractDefinition const* m_currentContract = nullptr;
217241

0 commit comments

Comments
 (0)