Esempio n. 1
0
        public Type GetType(string code, string typeName = default)
        {
            OopOperator oopOperator = OopOperator.Create(Compiler, OptionAction);
            string      result      = oopOperator
                                      .GetUsingBuilder()
                                      .Append(code).ToString();

            oopOperator.Compiler.SyntaxInfos.Add(result, oopOperator.Usings);

            var text = result;

            if (typeName == default)
            {
                typeName = ScriptHelper.GetClassName(text);
                if (typeName == default)
                {
                    typeName = ScriptHelper.GetInterfaceName(text);
                    if (typeName == default)
                    {
                        typeName = ScriptHelper.GetStructName(text);
                        if (typeName == default)
                        {
                            typeName = ScriptHelper.GetEnumName(text);
                        }
                    }
                }
            }

            return(oopOperator.Compiler.GetType(typeName));
        }