fix #1910
This commit is contained in:
parent
f6da093505
commit
3557eab81f
|
|
@ -2758,10 +2758,21 @@ namespace PascalABCCompiler
|
|||
{
|
||||
string dir = Path.Combine(Path.GetDirectoryName(Unit.SyntaxTree.file_name), directive.Replace(Path.DirectorySeparatorChar + "*.pas", ""));
|
||||
foreach (string file in Directory.EnumerateFiles(dir, "*.pas"))
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
throw new FileNotFound(file, cd.location);
|
||||
files.Add(file);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
files.Add(Path.Combine(Path.GetDirectoryName(Unit.SyntaxTree.file_name), directive));
|
||||
{
|
||||
string file = Path.Combine(Path.GetDirectoryName(Unit.SyntaxTree.file_name), directive);
|
||||
if (!File.Exists(file))
|
||||
throw new FileNotFound(file, cd.location);
|
||||
files.Add(file);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -2770,8 +2781,7 @@ namespace PascalABCCompiler
|
|||
List<SyntaxTree.unit_or_namespace> namespace_modules = new List<SyntaxTree.unit_or_namespace>();
|
||||
foreach (string file in files)
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
throw new FileNotFound(file);
|
||||
|
||||
SyntaxTree.compilation_unit tree = GetNamespaceSyntaxTree(file);
|
||||
if (!(tree is SyntaxTree.unit_module))
|
||||
throw new NamespaceModuleExpected(tree.source_context);
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
namespace PascalABCCompiler
|
||||
{
|
||||
|
||||
public class FileNotFound : TreeConverter.CompilationError
|
||||
public class FileNotFound : TreeConverter.CompilationErrorWithLocation
|
||||
{
|
||||
private string _file_name;
|
||||
|
||||
public FileNotFound(string file_name)
|
||||
public FileNotFound(string file_name, TreeRealization.location loc):base(loc)
|
||||
{
|
||||
_file_name=file_name;
|
||||
}
|
||||
|
|
@ -22,8 +22,8 @@ namespace PascalABCCompiler
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return ("File: "+_file_name+" not found");
|
||||
}
|
||||
return string.Format(StringResources.Get("COMPILATIONERROR_FILE_{0}_NOT_FOUND"), _file_name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ RESOURCEFILE_{0}_NOT_FOUND=Resource file '{0}' not found
|
|||
DUPLICATE_USES_UNIT{0}=Duplicate identifier '{0}' in uses section
|
||||
MAINRESOURCE_NOT_ALLOWED=mainresource can not be used with the directives: product, version, company, trademark
|
||||
DUPLICATE_DIRECTIVE{0}=Duplicate directive {0}
|
||||
FILE_{0}_NOT_FOUND=File '{0}' not found
|
||||
|
||||
%PREFIX%=
|
||||
COMPILER_INTERNAL_ERROR_IN_UNIT_{0}_:{1}=Internal compiler error in module {0} :'{1}'
|
||||
|
|
@ -14,6 +14,7 @@ RESOURCEFILE_{0}_NOT_FOUND=Файл '{0}' не найден
|
|||
DUPLICATE_USES_UNIT{0}=Повторное подключение модуля {0} в секции uses
|
||||
MAINRESOURCE_NOT_ALLOWED=Недопустимо совместное использование директивы mainresource и директив product, version, company, trademark
|
||||
DUPLICATE_DIRECTIVE{0}=Повторное объявление директивы {0}
|
||||
FILE_{0}_NOT_FOUND=Файл '{0}' не найден
|
||||
|
||||
%PREFIX%=
|
||||
COMPILER_INTERNAL_ERROR_IN_UNIT_{0}_:{1}=Внутренняя ошибка компилятора в модуле {0} :'{1}'
|
||||
|
|
@ -14,6 +14,7 @@ RESOURCEFILE_{0}_NOT_FOUND=Файл '{0}' не знайдено
|
|||
DUPLICATE_USES_UNIT{0}=Повторне підключення модуля {0} в секції uses
|
||||
MAINRESOURCE_NOT_ALLOWED=Неприпустимо сумісне використання директиви mainresource і директив product, version, company, trademark
|
||||
DUPLICATE_DIRECTIVE{0}=Повторное объявление директивы {0}
|
||||
FILE_{0}_NOT_FOUND=Файл '{0}' не знайдено
|
||||
|
||||
%PREFIX%=
|
||||
COMPILER_INTERNAL_ERROR_IN_UNIT_{0}_:{1}=Внутрішня помилка компілятора в модулі {0} :'{1}'
|
||||
Loading…
Reference in a new issue