예제 #1
0
        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));
            }
        }
예제 #2
0
        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));
            }
        }
예제 #3
0
 public IEnumerable <IPhpValue> GetExportedConstants()
 {
     return(ExtensionContainers
            .SelectMany(t => t.GetMembers().Where(IsGlobalConstant))
            .OfType <IPhpValue>());
 }