Esempio n. 1
0
        public object Eval()
        {
            Namespace ns = (Namespace)RT.CurrentNSVar.deref();

            ns.importClass(RT.classForNameE(_c));
            return(null);
        }
Esempio n. 2
0
        public static Type MaybeType(object form, bool stringOk)
        {
            if (form is Type)
            {
                return((Type)form);
            }

            Type t = null;

            if (form is Symbol)
            {
                Symbol sym = (Symbol)form;
                if (sym.Namespace == null) // if ns-qualified, can't be classname
                {
                    if (Util.equals(sym, Compiler.CompileStubSymVar.get()))
                    {
                        return((Type)Compiler.CompileStubClassVar.get());
                    }
                    if (sym.Name.IndexOf('.') > 0 || sym.Name[sym.Name.Length - 1] == ']')  // Array.  JVM version detects [whatever  notation.

                    {
                        t = RT.classForNameE(sym.Name);
                    }
                    else
                    {
                        object o = Compiler.CurrentNamespace.GetMapping(sym);
                        if (o is Type)
                        {
                            t = (Type)o;
                        }
                        else if (Compiler.LocalEnvVar.deref() != null && ((IPersistentMap)Compiler.LocalEnvVar.deref()).containsKey(form))  // JVM casts to java.util.Map
                        {
                            return(null);
                        }
                        else
                        {
                            try
                            {
                                t = RT.classForName(sym.Name);
                            }
                            catch (Exception)
                            {
                                // aargh
                                // leave t set to null -> return null
                            }
                        }
                    }
                }
            }
            else if (stringOk && form is string)
            {
                t = RT.classForNameE((string)form);
            }

            return(t);
        }
Esempio n. 3
0
        // At the moment, only used by the LispReader
        public static Object InvokeStaticMethod(String typeName, String methodName, Object[] args)
        {
            Type t = RT.classForNameE(typeName);

            return(InvokeStaticMethod(t, methodName, args));
        }