示例#1
0
        internal void ResolveFileUsings(Converter <string, IScriptFile> resolver)
        {
            var c = m_fileUsings.Count;

            for (int i = 0; i < c; i++)
            {
                if (m_fileUsings[i].Identifier.Reference == null)
                {
                    try
                    {
                        var resolved = resolver(m_fileUsings[i].Identifier.Name);
                        if (resolved != null)
                        {
                            m_fileUsings[i] = new UsingData(m_fileUsings[i].Line, m_fileUsings[i].Identifier.Name, IdentifierType.FileByName, resolved);
                            resolved.RegisterDependant(this);
                        }
                        else
                        {
                            m_errors.UnresolvedUsing(m_fileUsings[i].Line, -1, m_fileUsings[i].Identifier.Name);
                        }
                    }
                    catch (Exception ex)
                    {
                        m_errors.InternalError(m_fileUsings[i].Line, -1, "Exception thrown when resolving using. Exception: " + ex.GetType().Name + ", " + ex.Message);
                    }
                }
            }
        }