Exemplo n.º 1
0
        public override void QueryHighlightWordTag(List <ALanguageHighlightWordInfo> list)
        {
            if (m_method_dec == null)
            {
                ReloadInfo();
            }

            var error = m_element.GuessType(out ABnfGuess guess);

            if (error != null)
            {
                return;
            }
            CollectHighlight(guess, m_method_body_dec, list);

            // 处理参数
            if (m_method_dec != null)
            {
                var dec_list = ALittleScriptUtility.FindMethodParamNameDecList(m_method_dec, m_key);
                foreach (var dec in dec_list)
                {
                    var info = new ALanguageHighlightWordInfo();
                    info.start = dec.GetStart();
                    info.end   = dec.GetEnd();
                    list.Add(info);
                }
            }
        }
        public override ABnfElement GotoDefinition()
        {
            var class_dec = ALittleScriptUtility.FindClassDecFromParent(m_element);

            if (class_dec == null)
            {
                return(null);
            }

            var class_extends_dec = ALittleScriptUtility.FindClassExtends(class_dec);

            if (class_extends_dec == null)
            {
                return(null);
            }

            var extends_ctor_dec = ALittleScriptUtility.FindFirstCtorDecFromExtends(class_extends_dec, 100);

            if (extends_ctor_dec == null)
            {
                return(null);
            }

            return(extends_ctor_dec.GetKey());
        }
Exemplo n.º 3
0
        public override ABnfGuessError GuessTypes(out List <ABnfGuess> guess_list)
        {
            var all_type = m_element.GetAllType();

            if (all_type != null)
            {
                var error = all_type.GuessTypes(out guess_list);
                if (error != null)
                {
                    return(error);
                }
                var class_element_dec = m_element.GetParent() as ALittleScriptClassElementDecElement;
                if (class_element_dec == null)
                {
                    return(new ABnfGuessError(m_element, "父节点不是ALittleScriptClassElementDecElement类型"));
                }

                bool is_native = ALittleScriptUtility.IsNative(class_element_dec.GetModifierList());
                for (int i = 0; i < guess_list.Count; ++i)
                {
                    var guess = guess_list[i] as ALittleScriptGuessList;
                    if (guess != null && guess.is_native != is_native)
                    {
                        guess.is_native = is_native;
                        guess.UpdateValue();
                    }
                }
                return(null);
            }

            guess_list = new List <ABnfGuess>();
            return(null);
        }
Exemplo n.º 4
0
        protected void AddRelay(ABnfElement element)
        {
            if (element == null)
            {
                return;
            }

            var full_path = element.GetFullPath();

            if (full_path == m_file_path)
            {
                return;
            }

            if (ALittleScriptUtility.IsRegister(element))
            {
                return;
            }

            if (m_is_define_relay)
            {
                if (!m_define_rely.Contains(full_path))
                {
                    m_define_rely.Add(full_path);
                }
                return;
            }

            if (!m_run_rely.Contains(full_path))
            {
                m_run_rely.Add(full_path);
            }
        }
        private void ReloadInfo()
        {
            m_class_dec        = null;
            m_class_ctor_dec   = null;
            m_class_setter_dec = null;
            m_class_method_dec = null;
            m_class_static_dec = null;

            ABnfElement parent = m_element;

            while (true)
            {
                if (parent == null)
                {
                    break;
                }

                if (parent is ALittleScriptNamespaceDecElement)
                {
                    break;
                }
                else if (parent is ALittleScriptClassDecElement)
                {
                    m_class_dec = (ALittleScriptClassDecElement)parent;
                    break;
                }
                else if (parent is ALittleScriptClassCtorDecElement)
                {
                    m_class_ctor_dec = (ALittleScriptClassCtorDecElement)parent;
                }
                else if (parent is ALittleScriptClassGetterDecElement)
                {
                    m_class_getter_dec = (ALittleScriptClassGetterDecElement)parent;
                    var modifier = (m_class_getter_dec.GetParent() as ALittleScriptClassElementDecElement).GetModifierList();
                    m_is_const = ALittleScriptUtility.IsConst(modifier);
                }
                else if (parent is ALittleScriptClassSetterDecElement)
                {
                    m_class_setter_dec = (ALittleScriptClassSetterDecElement)parent;
                    var modifier = (m_class_setter_dec.GetParent() as ALittleScriptClassElementDecElement).GetModifierList();
                    m_is_const = ALittleScriptUtility.IsConst(modifier);
                }
                else if (parent is ALittleScriptClassMethodDecElement)
                {
                    m_class_method_dec = (ALittleScriptClassMethodDecElement)parent;
                    var modifier = (m_class_method_dec.GetParent() as ALittleScriptClassElementDecElement).GetModifierList();
                    m_is_const = ALittleScriptUtility.IsConst(modifier);
                }
                else if (parent is ALittleScriptClassStaticDecElement)
                {
                    m_class_static_dec = (ALittleScriptClassStaticDecElement)parent;
                }
                else if (parent is ALittleScriptGlobalMethodDecElement)
                {
                    m_global_method_dec = (ALittleScriptGlobalMethodDecElement)parent;
                }

                parent = parent.GetParent();
            }
        }
Exemplo n.º 6
0
        public override ABnfGuessError CheckError()
        {
            if (m_element.GetMethodNameDec() == null)
            {
                return(new ABnfGuessError(m_element, "没有函数名"));
            }

            if (m_element.GetMethodBodyDec() == null)
            {
                return(new ABnfGuessError(m_element, "没有函数体"));
            }

            var parent = m_element.GetParent() as ALittleScriptClassElementDecElement;

            if (parent == null)
            {
                return(new ABnfGuessError(m_element, "ALittleScriptClassStaticDecElement的父节点不是ALittleScriptClassElementDecElement"));
            }

            var co_text = ALittleScriptUtility.GetCoroutineType(parent.GetModifierList());

            int return_count = 0;
            var return_dec   = m_element.GetMethodReturnDec();

            if (return_dec != null)
            {
                return_count = return_dec.GetMethodReturnOneDecList().Count;
            }

            if (co_text == "async" && return_count > 0)
            {
                return(new ABnfGuessError(return_dec, "带async修饰的函数,不能有返回值"));
            }
            return(null);
        }
        public override bool QueryCompletion(int offset, List <ALanguageCompletionInfo> list)
        {
            var method_dec = m_element.GetParent();

            // 类内部的函数
            if (method_dec.GetParent() is ALittleScriptClassElementDecElement)
            {
                var class_dec = ALittleScriptUtility.FindClassDecFromParent(method_dec.GetParent());

                var dec_list = new List <ABnfElement>();
                ALittleScriptUtility.FindClassMethodNameDecList(class_dec, ALittleScriptUtility.sAccessPrivateAndProtectedAndPublic, "", dec_list, 100);
                for (int i = 0; i < dec_list.Count; ++i)
                {
                    list.Add(new ALanguageCompletionInfo(dec_list[i].GetElementText(), ALittleScriptIndex.inst.sMemberMethodIcon));
                }
            }
            // 全局函数
            else if (method_dec.GetParent() is ALittleScriptNamespaceElementDecElement)
            {
                var dec_list = ALittleScriptIndex.inst.FindALittleNameDecList(
                    ALittleScriptUtility.ABnfElementType.GLOBAL_METHOD, m_element.GetFile(), m_namespace_name, "", true);
                foreach (var dec in dec_list)
                {
                    list.Add(new ALanguageCompletionInfo(dec.GetElementText(), ALittleScriptIndex.inst.sGlobalMethodIcon));
                }
            }

            return(true);
        }
Exemplo n.º 8
0
        public override ABnfGuessError CheckError()
        {
            var value_stat = m_element.GetValueStat();

            if (value_stat == null)
            {
                return(new ABnfGuessError(m_element, "没有条件表达式"));
            }

            var error = ALittleScriptUtility.CalcReturnCount(value_stat, out int return_count, out _);

            if (error != null)
            {
                return(error);
            }
            if (return_count != 1)
            {
                return(new ABnfGuessError(value_stat, "表达式必须只能是一个返回值"));
            }

            error = value_stat.GuessType(out ABnfGuess guess);
            if (error != null)
            {
                return(error);
            }
            if (guess is ALittleScriptGuessBool)
            {
                return(null);
            }

            return(new ABnfGuessError(m_element, "这里必须是一个bool表达式"));
        }
Exemplo n.º 9
0
        public override ABnfGuessError CheckError()
        {
            var value_stat = m_element.GetValueStat();

            if (value_stat == null)
            {
                return(null);
            }

            var error = ALittleScriptUtility.CalcReturnCount(value_stat, out int return_count, out _);

            if (error != null)
            {
                return(error);
            }
            if (return_count != 1)
            {
                return(new ABnfGuessError(value_stat, "表达式必须只能是一个返回值"));
            }

            error = value_stat.GuessType(out ABnfGuess guess);
            if (error != null)
            {
                return(error);
            }

            if (guess.is_const)
            {
                return(new ABnfGuessError(m_element, "const类型不能使用--或者++运算符"));
            }
            return(null);
        }
        public override ABnfElement GotoDefinition()
        {
            var method_dec = m_element.GetParent();

            if (method_dec == null)
            {
                return(null);
            }
            var class_element_dec = method_dec.GetParent();

            if (class_element_dec == null)
            {
                return(null);
            }
            var class_body = method_dec.GetParent();

            if (class_body == null)
            {
                return(null);
            }
            var class_dec = class_body.GetParent() as ALittleScriptClassDecElement;

            if (class_dec == null)
            {
                return(null);
            }

            // 计算父类
            var class_extends_dec = ALittleScriptUtility.FindClassExtends(class_dec);

            if (class_extends_dec == null)
            {
                return(null);
            }

            ALittleScriptUtility.ClassAttrType attrType;
            if (method_dec is ALittleScriptClassMethodDecElement)
            {
                attrType = ALittleScriptUtility.ClassAttrType.FUN;
            }
            else if (method_dec is ALittleScriptClassStaticDecElement)
            {
                attrType = ALittleScriptUtility.ClassAttrType.STATIC;
            }
            else if (method_dec is ALittleScriptClassGetterDecElement)
            {
                attrType = ALittleScriptUtility.ClassAttrType.GETTER;
            }
            else if (method_dec is ALittleScriptClassSetterDecElement)
            {
                attrType = ALittleScriptUtility.ClassAttrType.SETTER;
            }
            else
            {
                return(null);
            }

            return(ALittleScriptUtility.FindFirstClassAttrFromExtends(class_extends_dec, attrType, m_key, 100));
        }
Exemplo n.º 11
0
 public ALittleScriptGuessStructName(string p_namespace_name, string p_struct_name
                                     , ALittleScriptStructNameDecElement p_struct_name_dec)
 {
     is_register     = ALittleScriptUtility.IsRegister(p_struct_name_dec);
     namespace_name  = p_namespace_name;
     struct_name     = p_struct_name;
     struct_name_dec = p_struct_name_dec;
 }
 public ALittleScriptGuessEnum(string p_namespace_name, string p_enum_name
                               , ALittleScriptEnumDecElement p_enum_dec)
 {
     is_register    = ALittleScriptUtility.IsRegister(p_enum_dec);
     namespace_name = p_namespace_name;
     enum_name      = p_enum_name;
     enum_dec       = p_enum_dec;
 }
 public ALittleScriptGuessClassName(string p_namespace_name, string p_class_name
                                    , ALittleScriptClassNameDecElement p_class_name_dec)
 {
     is_register    = ALittleScriptUtility.IsRegister(p_class_name_dec);
     namespace_name = p_namespace_name;
     class_name     = p_class_name;
     class_name_dec = p_class_name_dec;
 }
 public ALittleScriptClassDecElement GetClassDec()
 {
     if (m_class_dec != null)
     {
         return(m_class_dec);
     }
     m_class_dec = ALittleScriptUtility.FindClassDecFromParent(m_element);
     return(m_class_dec);
 }
 public ALittleScriptTemplateDecElement GetTemplateDec()
 {
     if (m_template_param_dec != null)
     {
         return(m_template_param_dec);
     }
     m_template_param_dec = ALittleScriptUtility.FindMethodTemplateDecFromParent(m_element);
     return(m_template_param_dec);
 }
Exemplo n.º 16
0
 public ALittleScriptGuessStruct(string p_namespace_name, string p_struct_name
                                 , ALittleScriptStructDecElement p_struct_dec, bool p_is_const)
 {
     is_register    = ALittleScriptUtility.IsRegister(p_struct_dec);
     namespace_name = p_namespace_name;
     struct_name    = p_struct_name;
     struct_dec     = p_struct_dec;
     is_const       = p_is_const;
 }
        public override ABnfGuessError CheckError()
        {
            var value_stat_list = m_element.GetValueStatList();

            if (value_stat_list.Count == 0)
            {
                return(new ABnfGuessError(m_element, "assert表达式不能没有参数"));
            }

            if (value_stat_list.Count != 2)
            {
                return(new ABnfGuessError(m_element, "assert有且仅有两个参数,第一个是任意类型,第二个是string"));
            }

            var value_stat = value_stat_list[0];

            var error = ALittleScriptUtility.CalcReturnCount(value_stat, out int return_count, out _);

            if (error != null)
            {
                return(error);
            }
            if (return_count != 1)
            {
                return(new ABnfGuessError(value_stat, "表达式必须只能是一个返回值"));
            }

            error = value_stat.GuessType(out ABnfGuess guess);
            if (error != null)
            {
                return(error);
            }

            value_stat = value_stat_list[1];

            error = ALittleScriptUtility.CalcReturnCount(value_stat, out return_count, out _);
            if (error != null)
            {
                return(error);
            }
            if (return_count != 1)
            {
                return(new ABnfGuessError(value_stat, "表达式必须只能是一个返回值"));
            }

            error = value_stat.GuessType(out guess);
            if (error != null)
            {
                return(error);
            }
            if (!(guess is ALittleScriptGuessString))
            {
                return(new ABnfGuessError(value_stat, "assert表达式第二个参数必须是string类型"));
            }
            return(null);
        }
        public override ABnfGuessError CheckError()
        {
            // 检查这次所在的函数必须要有await或者async修饰
            ABnfElement parent = m_element;

            while (parent != null)
            {
                if (parent is ALittleScriptNamespaceDecElement)
                {
                    break;
                }
                else if (parent is ALittleScriptClassCtorDecElement)
                {
                    break;
                }
                else if (parent is ALittleScriptClassGetterDecElement)
                {
                    break;
                }
                else if (parent is ALittleScriptClassSetterDecElement)
                {
                    break;
                }
                else if (parent is ALittleScriptClassMethodDecElement)
                {
                    var modifier = (parent.GetParent() as ALittleScriptClassElementDecElement).GetModifierList();
                    if (ALittleScriptUtility.GetCoroutineType(modifier) == "await")
                    {
                        return(null);
                    }
                    break;
                }
                else if (parent is ALittleScriptClassStaticDecElement)
                {
                    var modifier = (parent.GetParent() as ALittleScriptClassElementDecElement).GetModifierList();
                    if (ALittleScriptUtility.GetCoroutineType(modifier) == "await")
                    {
                        return(null);
                    }
                    break;
                }
                else if (parent is ALittleScriptGlobalMethodDecElement)
                {
                    var modifier = (parent.GetParent() as ALittleScriptNamespaceElementDecElement).GetModifierList();
                    if (ALittleScriptUtility.GetCoroutineType(modifier) == "await")
                    {
                        return(null);
                    }
                    break;
                }
                parent = parent.GetParent();
            }

            return(new ABnfGuessError(m_element, "co关键字只能在await修饰的函数中使用"));
        }
 public ALittleScriptGuessClass(string p_namespace_name, string p_class_name
                                , ALittleScriptClassDecElement p_class_dec, string p_using_name, bool p_is_const, bool p_is_native)
 {
     is_register    = ALittleScriptUtility.IsRegister(p_class_dec);
     namespace_name = p_namespace_name;
     class_name     = p_class_name;
     class_dec      = p_class_dec;
     using_name     = p_using_name;
     is_const       = p_is_const;
     is_native      = p_is_native;
 }
        public static ABnfGuessError FindDefineRelay(ProjectInfo project, string file_path, HashSet <string> result)
        {
            var file = project.GetFile(file_path);

            if (file == null)
            {
                return(null);
            }

            var abnf_file = file.GetFile();

            if (abnf_file == null)
            {
                return(null);
            }

            var dec = ALittleScriptUtility.GetNamespaceDec(abnf_file);

            if (dec == null)
            {
                return(null);
            }
            var element_dec_list = dec.GetNamespaceElementDecList();

            foreach (var element_dec in element_dec_list)
            {
                if (element_dec.GetClassDec() != null)
                {
                    var extendsDec = element_dec.GetClassDec().GetClassExtendsDec();
                    if (extendsDec == null)
                    {
                        continue;
                    }
                    var error = extendsDec.GuessType(out var guess);
                    if (!(guess is ALittleScriptGuessClass))
                    {
                        continue;
                    }
                    var element = ((ALittleScriptGuessClass)guess).GetElement();
                    if (element == null)
                    {
                        continue;
                    }
                    if (file_path == element.GetFullPath())
                    {
                        continue;
                    }
                    result.Add(element.GetFullPath());
                }
            }
            return(null);
        }
        public override ABnfGuessError CheckError()
        {
            if (m_element.GetNumber() == null)
            {
                return(null);
            }

            if (!ALittleScriptUtility.IsInt(m_element.GetNumber()))
            {
                return(new ABnfGuessError(m_element.GetNumber(), "枚举值必须是整数"));
            }
            return(null);
        }
        private ABnfGuessError CheckCmdError()
        {
            var    parent       = m_element.GetParent() as ALittleScriptNamespaceElementDecElement;
            string command_type = ALittleScriptUtility.GetCommandDetail(parent.GetModifierList(), out string desc);

            if (command_type == null)
            {
                return(null);
            }

            if (m_element.GetTemplateDec() != null)
            {
                return(new ABnfGuessError(m_element, "带Cmd的全局函数,不能使用模板"));
            }
            return(null);
        }
Exemplo n.º 23
0
        public override ABnfGuessError CheckError()
        {
            if (m_element.GetElementText().StartsWith("___"))
            {
                return(new ABnfGuessError(m_element, "变量名不能以3个下划线开头"));
            }

            var error = m_element.GuessTypes(out List <ABnfGuess> guess_list);

            if (error != null)
            {
                return(error);
            }
            if (guess_list.Count == 0)
            {
                return(new ABnfGuessError(m_element, "未知类型"));
            }
            else if (guess_list.Count != 1)
            {
                return(new ABnfGuessError(m_element, "重复定义"));
            }

            if (m_method_dec == null)
            {
                ReloadInfo();
            }

            // 处理参数
            if (m_method_dec != null)
            {
                var dec_list = ALittleScriptUtility.FindMethodParamNameDecList(m_method_dec, m_key);
                if (dec_list.Count > 0)
                {
                    return(new ABnfGuessError(m_element, "重复定义"));
                }
            }
            // 处理表达式定义
            {
                var dec_list = ALittleScriptUtility.FindVarAssignNameDecList(m_element, m_key);
                if (dec_list.Count > 0)
                {
                    return(new ABnfGuessError(m_element, "重复定义"));
                }
            }

            return(null);
        }
        public List <ABnfElement> FindALittleNameDecList(ALittleScriptUtility.ABnfElementType type
                                                         , ABnfFile file, string namespace_name, string name, bool find_in_global)
        {
            var result = new List <ABnfElement>();
            ALittleScriptAccessData data;

            // 查本文件的
            var file_namespace_name = ALittleScriptUtility.GetNamespaceName(file);

            if (file_namespace_name == namespace_name)
            {
                if (m_file_access_map.TryGetValue(file, out data))
                {
                    data.FindNameDecList(type, name, result);
                }
            }

            // 查本命名域的
            if (file_namespace_name == namespace_name)
            {
                if (m_namespace_access_map.TryGetValue(namespace_name, out data))
                {
                    data.FindNameDecList(type, name, result);
                }
            }

            // 查全局下
            if (find_in_global)
            {
                if (type == ALittleScriptUtility.ABnfElementType.INSTANCE_NAME)
                {
                    foreach (var pair in m_global_access_map)
                    {
                        pair.Value.FindNameDecList(type, name, result);
                    }
                }
                else
                {
                    if (m_global_access_map.TryGetValue(namespace_name, out data))
                    {
                        data.FindNameDecList(type, name, result);
                    }
                }
            }

            return(result);
        }
Exemplo n.º 25
0
        public ALittleScriptStructNameDecReference(ABnfElement element) : base(element)
        {
            m_key            = m_element.GetElementText();
            m_namespace_name = ALittleScriptUtility.GetNamespaceName(m_element);

            // 如果父节点是extends,那么就获取指定的命名域
            var parent = element.GetParent();

            if (parent is ALittleScriptStructExtendsDecElement)
            {
                var namespace_name_dec = ((ALittleScriptStructExtendsDecElement)parent).GetNamespaceNameDec();
                if (namespace_name_dec != null)
                {
                    m_namespace_name = namespace_name_dec.GetElementText();
                }
            }
        }
Exemplo n.º 26
0
        public ALittleScriptClassExtendsDecReference(ABnfElement element) : base(element)
        {
            if (m_element.GetNamespaceNameDec() != null)
            {
                m_namespace_name = m_element.GetNamespaceNameDec().GetElementText();
            }
            else
            {
                m_namespace_name = ALittleScriptUtility.GetNamespaceName(m_element);
            }

            m_key = "";
            if (m_element.GetClassNameDec() != null)
            {
                m_key = m_element.GetClassNameDec().GetElementText();
            }
        }
        public override ABnfGuessError GuessTypes(out List <ABnfGuess> guess_list)
        {
            guess_list = null;

            var name_dec = m_element.GetClassNameDec();

            if (name_dec == null)
            {
                return(new ABnfGuessError(m_element, "没有定义类名"));
            }

            var body_dec = m_element.GetClassBodyDec();

            if (body_dec == null)
            {
                return(new ABnfGuessError(m_element, "没有定义类体"));
            }

            var namespace_element_dec = m_element.GetParent() as ALittleScriptNamespaceElementDecElement;

            if (namespace_element_dec == null)
            {
                return(new ABnfGuessError(m_element, "ALittleScriptClassDecReference的父节点不是ALittleScriptNamespaceElementDecElement"));
            }

            bool is_native    = ALittleScriptUtility.IsNative(namespace_element_dec.GetModifierList());
            var  info         = new ALittleScriptGuessClass(m_namespace_name, name_dec.GetElementText(), m_element, null, false, is_native);
            var  template_dec = m_element.GetTemplateDec();

            if (template_dec != null)
            {
                var error = template_dec.GuessTypes(out info.template_list);
                if (error != null)
                {
                    return(error);
                }
            }
            info.UpdateValue();

            guess_list = new List <ABnfGuess>()
            {
                info
            };
            return(null);
        }
Exemplo n.º 28
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            // 向当前文件窗口发送一个格式化命令
            if (m_text_manager == null)
            {
                return;
            }
            m_text_manager.GetActiveView(1, null, out IVsTextView view);
            if (view == null)
            {
                return;
            }
            if (m_adapters_factory == null)
            {
                return;
            }
            var text_view = m_adapters_factory.GetWpfTextView(view);

            if (text_view == null)
            {
                return;
            }

            if (!text_view.Properties.TryGetProperty(nameof(UIViewItem), out UIViewItem info))
            {
                return;
            }

            string ext = "lua";

            if (GeneralOptions.Instance.TargetLanguage == TargetLanguages.JavaScript)
            {
                ext = "js";
            }

            string full_path = ALittleScriptUtility.CalcTargetFullPath(info.GetProjectPath(), info.GetFullPath(), ext, out _);

            if (full_path == null)
            {
                return;
            }
            ALanguageUtility.OpenFile(null, ALittleScriptVsTextViewCreationListener.s_adapters_factory, full_path, 0, 0);
        }
Exemplo n.º 29
0
        // 检查表达式是否有return
        public static ABnfGuessError CheckAllExprList(List <ABnfGuess> return_list, List <ALittleScriptAllExprElement> all_expr_list, out bool result)
        {
            result = false;
            // 如果没有就检查子表达式
            int index = -1;

            for (int i = 0; i < all_expr_list.Count; ++i)
            {
                var all_expr = all_expr_list[i];
                if (!ALittleScriptUtility.IsLanguageEnable(all_expr.GetModifierList()))
                {
                    continue;
                }

                var error = CheckAllExpr(return_list, all_expr_list[i], out bool sub_result);
                if (error != null)
                {
                    return(error);
                }
                if (sub_result)
                {
                    index = i;
                    break;
                }
            }
            if (index == -1)
            {
                return(null);
            }

            for (int i = index + 1; i < all_expr_list.Count; ++i)
            {
                var all_expr = all_expr_list[i];
                if (!ALittleScriptUtility.IsLanguageEnable(all_expr.GetModifierList()))
                {
                    continue;
                }
                return(new ABnfGuessError(all_expr, "当前分支内,从这里开始之后所有语句永远都不会执行到"));
            }

            result = true;
            return(null);
        }
        public override ABnfGuessError GuessTypes(out List <ABnfGuess> guess_list)
        {
            var value_stat = m_element.GetValueStat();

            if (value_stat != null)
            {
                var error = ALittleScriptUtility.CalcReturnCount(value_stat, out int return_count, out guess_list);
                if (error != null)
                {
                    return(error);
                }
                if (return_count != 1)
                {
                    return(new ABnfGuessError(value_stat, "表达式必须只能是一个返回值"));
                }
                return(null);
            }
            guess_list = new List <ABnfGuess>();
            return(null);
        }