public override void Visit(ExprDotName expressionDotName) { _cancellationToken.ThrowIfCancellationRequested(); base.Visit(expressionDotName); if (_typeResolver.TryGetTypeSymbol(expressionDotName.Lhs, out var leftHandSideType)) { RegisterDesignator(leftHandSideType, expressionDotName, expressionDotName.tok, expressionDotName.SuffixName); } }
/// <summary> /// Tries to resolve the type of the given symbol. /// </summary> /// <param name="symbol">The symbol to get the type of.</param> /// <param name="type">The type of the symbol, or <c>null</c> if the type could not be resolved. If <paramref name="symbol"/> is already a type, it is returned.</param> /// <returns><c>true</c> if the type was successfully resolved, otherwise <c>false</c>.</returns> public bool TryGetTypeOf(ISymbol symbol, [NotNullWhen(true)] out ISymbol?type) { if (symbol is TypeWithMembersSymbolBase) { // TODO other type symbols should be supported in the future. type = symbol; return(true); } var dafnyType = symbol switch { FieldSymbol field => field.Declaration.Type, VariableSymbol variable => variable.Declaration.Type, _ => null }; if (dafnyType == null) { type = null; return(false); } return(typeResolver.TryGetTypeSymbol(dafnyType, out type)); } }