public IPhpRoutineSymbol ResolveFunction(QualifiedName name) { // library functions, public static methods var methods = new List <MethodSymbol>(); foreach (var m in ExtensionContainers.SelectMany(r => r.GetMembers(name.ClrName(), true)).OfType <MethodSymbol>().Where(IsFunction)) { methods.Add(m); } if (methods.Count == 0) { // source functions return(_next.ResolveFunction(name)); } else if (methods.Count == 1) { return(methods[0]); } else { bool userfunc = methods.Any(m => m.ContainingType.IsPhpSourceFile()); // if the function is user defined (PHP), we might not treat this as CLR method (ie do not resolve overloads in compile time) return(new AmbiguousMethodSymbol(methods.AsImmutable(), overloadable: !userfunc)); } }
public IPhpRoutineSymbol ResolveFunction(QualifiedName name) { // library functions, public static methods var methods = new List <MethodSymbol>(); foreach (var m in ExtensionContainers.SelectMany(r => r.GetMembers(name.ClrName(), true)).OfType <MethodSymbol>().Where(IsFunction)) { methods.Add(m); } if (methods.Count == 0) { // source functions return(_next.ResolveFunction(name)); } else if (methods.Count == 1) { return(methods[0]); } else { return(new AmbiguousMethodSymbol(methods.AsImmutable(), true)); } }
public IEnumerable <IPhpValue> GetExportedConstants() { return(ExtensionContainers .SelectMany(t => t.GetMembers().Where(IsGlobalConstant)) .OfType <IPhpValue>()); }