public void CheckConflict(ParseInfo parseInfo, CheckConflict identifier, DocRange range) => RulesetScope.CheckConflict(parseInfo, identifier, range);
 void IScopeAppender.AddStaticBasedScope(IMethod function) => RulesetScope.AddNativeMethod(function);
 void IScopeAppender.AddStaticBasedScope(IVariableInstance variable) => RulesetScope.AddNativeVariable(variable);
        void Translate()
        {
            AddComponent <RecursionCheckComponent>();

            // Get the enums
            foreach (ScriptFile script in Importer.ScriptFiles)
            {
                foreach (var enumContext in script.Context.Enums)
                {
                    var newEnum = new GenericCodeTypeInitializer(new DefinedEnum(new ParseInfo(script, this), enumContext));
                    RulesetScope.AddType(newEnum);
                    Types.AllTypes.Add(newEnum);
                    Types.DefinedTypes.Add(newEnum);
                }
            }

            // Get the types
            foreach (ScriptFile script in Importer.ScriptFiles)
            {
                foreach (var typeContext in script.Context.Classes)
                {
                    var newType = IDefinedTypeInitializer.GetInitializer(new ParseInfo(script, this), RulesetScope, typeContext);
                    RulesetScope.AddType(newType);
                    Types.AllTypes.Add(newType);
                    Types.DefinedTypes.Add(newType);
                }
            }

            // Get the variable reservations
            foreach (ScriptFile script in Importer.ScriptFiles)
            {
                foreach (Token reservation in script.Context.GlobalvarReservations)
                {
                    string text = reservation.GetText().RemoveQuotes();

                    if (Int32.TryParse(text, out int id))
                    {
                        VarCollection.Reserve(id, true, script.Diagnostics, reservation.Range);
                    }
                    else
                    {
                        VarCollection.Reserve(text, true);
                    }
                }
                foreach (Token reservation in script.Context.PlayervarReservations)
                {
                    string text = reservation.GetText().RemoveQuotes();

                    if (Int32.TryParse(text, out int id))
                    {
                        VarCollection.Reserve(id, false, script.Diagnostics, reservation.Range);
                    }
                    else
                    {
                        VarCollection.Reserve(text, false);
                    }
                }
            }
            // Get variable declarations
            foreach (ScriptFile script in Importer.ScriptFiles)
            {
                foreach (var declaration in script.Context.Declarations)
                {
                    if (declaration is VariableDeclaration variable)
                    {
                        Var var = new RuleLevelVariable(RulesetScope, new DefineContextHandler(new ParseInfo(script, this), variable)).GetVar();

                        if (var.StoreType != StoreType.None)
                        {
                            rulesetVariables.Add(var);

                            // Add the variable to the player variables scope if it is a player variable.
                            if (var.VariableType == VariableType.Player)
                            {
                                PlayerVariableScope.CopyVariable(var.GetDefaultInstance(null));
                            }
                        }
                    }
                }
            }

            ElementList.AddWorkshopFunctionsToScope(GlobalScope, Types); // Add workshop methods to global scope.
            GlobalFunctions.GlobalFunctions.Add(this, GlobalScope);      // Add built-in methods.

            // Get the function declarations
            foreach (ScriptFile script in Importer.ScriptFiles)
            {
                ParseInfo parseInfo = new ParseInfo(script, this);
                foreach (var declaration in script.Context.Declarations)
                {
                    if (declaration is FunctionContext function)
                    {
                        DefinedMethodProvider.GetDefinedMethod(parseInfo, this, function, null);
                    }
                }
            }

            StagedInitiation.Start();

            // Get hooks
            foreach (ScriptFile script in Importer.ScriptFiles)
            {
                foreach (var hookContext in script.Context.Hooks)
                {
                    HookVar.GetHook(new ParseInfo(script, this), RulesetScope, hookContext);
                }
            }

            // Get the rules
            foreach (ScriptFile script in Importer.ScriptFiles)
            {
                foreach (var ruleContext in script.Context.Rules)
                {
                    rules.Add(new RuleAction(new ParseInfo(script, this), RulesetScope, ruleContext));
                }
            }

            GetComponent <SymbolLinkComponent>().Collect();
        }