public override void VisitFunctionReference(AstFunctionReference function) { function.VisitChildren(this); if (function.FunctionDefinition is null) { if (!function.TryResolveSymbol()) { if (function.IsTemplateOrGeneric) { var symbol = function.Symbol; var templateFunction = FindTemplateDefinition <AstFunctionDefinition>(function, AstSymbolKind.Function); if (templateFunction is not null) { if (!templateFunction.IsExternal) { var typeDef = new AstTemplateInstanceFunction(templateFunction !); typeDef.Instantiate(_context, function); symbol.AddNode(typeDef); Visit(typeDef); } else { symbol.AddNode(templateFunction); } } } } // in case of overloads, TryResolve may succeed (finding the correct Symbol) // but FunctionDefinition may still be null (FunctionReference.OverloadKey does not match functionDef) if (!function.DeferResolveDefinition && function.FunctionDefinition is null) { if (!MatchFunctionToDefinition(function)) { _context.UndefinedFunction(function); } } // make sure all new types are resolved. function.VisitChildren(this); } if (!function.FunctionType.HasTypeReference && (function.FunctionDefinition?.FunctionType.HasTypeReference ?? false)) { var typeRef = function.FunctionDefinition.FunctionType.TypeReference.MakeCopy(); function.FunctionType.SetTypeReference(typeRef); // if type is intrinsic the symbol may not be set. if (!typeRef.HasSymbol) { function.Symbol.SymbolTable.Add(typeRef); } Visit(typeRef); } }
public override void VisitFunctionReference(AstFunctionReference function) { if (function.HasSymbol) { function.Symbol.RemoveReference(function); } base.VisitFunctionReference(function); }
public override void VisitFunctionReference(AstFunctionReference function) { if (function.EnforceReturnValueUse && function.ParentAs <AstCodeBlock>() is not null && function.FunctionType.HasTypeReference && function.FunctionType.TypeReference.TypeDefinition?.Identifier != AstIdentifierIntrinsic.Void) { _errorSite.FunctionReturnValueNotUsed(function); } }
public override void VisitFunctionReference(AstFunctionReference function) { var functionDef = function.FunctionDefinition !; var name = functionDef.Identifier.SymbolName.CanonicalName.FullName; if (functionDef.IsExternal) { name = functionDef.Identifier.NativeFullName; } Context.CodeBuilder.CsBuilder.Append($"{name}("); function.VisitChildren(this); Context.CodeBuilder.CsBuilder.EndLine(")"); }
public override void VisitFunctionReference(AstFunctionReference function) { function.FunctionType.TypeReference.Should().NotBeNull(); function.VisitChildren(this); }
public virtual void VisitFunctionReference(AstFunctionReference function) { function.VisitChildren(this); }