Merge pull request #2246 from SunSerega/uses-in-new
Re: Адекватные uses-in
This commit is contained in:
commit
9a026595ec
|
|
@ -372,7 +372,7 @@ namespace CodeCompletion
|
|||
Dirs.Add(CodeCompletionController.comp.CompilerOptions.SearchDirectory);
|
||||
if (CodeCompletionController.StandartDirectories.ContainsKey(LibSourceDirectoryIdent))
|
||||
Dirs.Add((string)CodeCompletionController.StandartDirectories[LibSourceDirectoryIdent]);
|
||||
return CodeCompletionController.comp.FindSourceFileName(unit_name, Dirs.ToArray());
|
||||
return CodeCompletionController.comp.FindSourceFileNameInDirs(unit_name, Dirs.ToArray());
|
||||
}
|
||||
|
||||
public static CodeCompletionNameHelper Helper
|
||||
|
|
|
|||
|
|
@ -2414,7 +2414,7 @@ namespace CodeCompletion
|
|||
|
||||
public string FindPCUFileName(string UnitName)
|
||||
{
|
||||
return CodeCompletionController.comp.FindPCUFileNameWithoutSources(UnitName,System.IO.Path.GetDirectoryName(doc.file_name));
|
||||
return CodeCompletionController.comp.FindPCUFileName(UnitName,System.IO.Path.GetDirectoryName(doc.file_name), out _);
|
||||
}
|
||||
|
||||
private void add_system_unit()
|
||||
|
|
@ -2612,20 +2612,9 @@ namespace CodeCompletion
|
|||
NamespaceScope ns_scope = null;
|
||||
if (i == 0)
|
||||
{
|
||||
string unit_name = null;
|
||||
string pcu_unit_name = FindPCUFileName(str);
|
||||
if (s is uses_unit_in)
|
||||
{
|
||||
string unit_in_file = (s as uses_unit_in).in_file.Value;
|
||||
string unit_in_dir = null;
|
||||
if (Path.IsPathRooted(unit_in_file))
|
||||
unit_in_dir = Path.GetDirectoryName(unit_in_file);
|
||||
else
|
||||
unit_in_dir = Path.Combine(Path.GetDirectoryName(_program_module.file_name),Path.GetDirectoryName(unit_in_file));
|
||||
unit_name = CodeCompletionNameHelper.FindSourceFileName(Path.GetFileNameWithoutExtension(unit_in_file), unit_in_dir);
|
||||
}
|
||||
else
|
||||
unit_name = CodeCompletionNameHelper.FindSourceFileName(str, System.IO.Path.GetDirectoryName(_program_module.file_name));
|
||||
string unit_name = CodeCompletionNameHelper.FindSourceFileName(s is uses_unit_in uui ? uui.in_file.Value : str, Path.GetDirectoryName(_program_module.file_name));
|
||||
|
||||
/*if (pcu_unit_name != null && unit_name != null && string.Compare(System.IO.Path.GetDirectoryName(_program_module.file_name), System.IO.Path.GetDirectoryName(pcu_unit_name), true) == 0
|
||||
&& string.Compare(System.IO.Path.GetDirectoryName(_program_module.file_name), System.IO.Path.GetDirectoryName(unit_name), true) != 0)
|
||||
unit_name = null;*/
|
||||
|
|
@ -4370,20 +4359,9 @@ namespace CodeCompletion
|
|||
{
|
||||
try
|
||||
{
|
||||
string unit_name = null;
|
||||
string pcu_unit_name = FindPCUFileName(str);
|
||||
if (s is uses_unit_in)
|
||||
{
|
||||
string unit_in_file = (s as uses_unit_in).in_file.Value;
|
||||
string unit_in_dir = null;
|
||||
if (Path.IsPathRooted(unit_in_file))
|
||||
unit_in_dir = Path.GetDirectoryName(unit_in_file);
|
||||
else
|
||||
unit_in_dir = Path.Combine(Path.GetDirectoryName(this.cur_unit_file_name),Path.GetDirectoryName(unit_in_file));
|
||||
unit_name = CodeCompletionNameHelper.FindSourceFileName(Path.GetFileNameWithoutExtension(unit_in_file), unit_in_dir);
|
||||
}
|
||||
else
|
||||
unit_name = CodeCompletionNameHelper.FindSourceFileName(str, System.IO.Path.GetDirectoryName(this.cur_unit_file_name));
|
||||
string unit_name = CodeCompletionNameHelper.FindSourceFileName(s is uses_unit_in uui ? uui.in_file.Value : str, Path.GetDirectoryName(this.cur_unit_file_name));
|
||||
|
||||
/*if (pcu_unit_name != null && unit_name != null && string.Compare(System.IO.Path.GetDirectoryName(this.cur_unit_file_name), System.IO.Path.GetDirectoryName(pcu_unit_name), true) == 0
|
||||
&& string.Compare(System.IO.Path.GetDirectoryName(this.cur_unit_file_name), System.IO.Path.GetDirectoryName(unit_name), true) != 0)
|
||||
unit_name = null;*/
|
||||
|
|
@ -4503,12 +4481,9 @@ namespace CodeCompletion
|
|||
{
|
||||
try
|
||||
{
|
||||
string unit_name = null;
|
||||
string pcu_unit_name = FindPCUFileName(str);
|
||||
if (s is uses_unit_in)
|
||||
unit_name = (s as uses_unit_in).in_file.Value;
|
||||
else
|
||||
unit_name = CodeCompletionNameHelper.FindSourceFileName(str, System.IO.Path.GetDirectoryName(this.cur_unit_file_name));
|
||||
string unit_name = CodeCompletionNameHelper.FindSourceFileName(s is uses_unit_in uui ? uui.in_file.Value : str, Path.GetDirectoryName(this.cur_unit_file_name));
|
||||
|
||||
/*if (pcu_unit_name != null && unit_name != null && string.Compare(System.IO.Path.GetDirectoryName(this.cur_unit_file_name), System.IO.Path.GetDirectoryName(pcu_unit_name), true) == 0
|
||||
&& string.Compare(System.IO.Path.GetDirectoryName(this.cur_unit_file_name), System.IO.Path.GetDirectoryName(unit_name), true) != 0)
|
||||
unit_name = null;*/
|
||||
|
|
@ -5162,7 +5137,7 @@ namespace CodeCompletion
|
|||
}
|
||||
else
|
||||
{
|
||||
string unit_name = CodeCompletionController.comp.FindSourceFileName(str);
|
||||
string unit_name = CodeCompletionController.comp.FindSourceFileName(str, System.IO.Path.GetDirectoryName(_c_module.file_name), out _);
|
||||
if (unit_name == null)
|
||||
{
|
||||
unit_name = Path.Combine(System.IO.Path.GetDirectoryName(_c_module.file_name), str) + System.IO.Path.GetExtension(_c_module.file_name);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -28,15 +28,15 @@ namespace PascalABCCompiler
|
|||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
settings.Indent = true;
|
||||
xtw = XmlTextWriter.Create(Path.ChangeExtension(cu.UnitName, ".xml"), settings);
|
||||
unit_name = Path.GetFileNameWithoutExtension(cu.UnitName);
|
||||
xtw = XmlTextWriter.Create(Path.ChangeExtension(cu.UnitFileName, ".xml"), settings);
|
||||
unit_name = Path.GetFileNameWithoutExtension(cu.UnitFileName);
|
||||
xtw.WriteStartDocument();
|
||||
xtw.WriteStartElement("doc");
|
||||
if (is_assembly)
|
||||
{
|
||||
xtw.WriteStartElement("assembly");
|
||||
xtw.WriteStartElement("name");
|
||||
xtw.WriteString(Path.GetFileNameWithoutExtension(cu.UnitName));
|
||||
xtw.WriteString(Path.GetFileNameWithoutExtension(cu.UnitFileName));
|
||||
xtw.WriteEndElement();
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ namespace PascalABCCompiler
|
|||
xtw.WriteStartElement("unit");
|
||||
xtw.WriteStartAttribute("name");
|
||||
//xtw.WriteString((cu.SemanticTree as common_unit_node).unit_name);
|
||||
xtw.WriteString(Path.GetFileNameWithoutExtension(cu.UnitName));
|
||||
xtw.WriteString(Path.GetFileNameWithoutExtension(cu.UnitFileName));
|
||||
xtw.WriteEndAttribute();
|
||||
xtw.WriteString(cu.SemanticTree.documentation);
|
||||
xtw.WriteEndElement();
|
||||
|
|
|
|||
|
|
@ -189,14 +189,6 @@ namespace PascalABCCompiler.PCU
|
|||
return already_compiled[name] != null;
|
||||
}
|
||||
|
||||
public static bool ContainsUnit(string FileName, out PCUReader pr)
|
||||
{
|
||||
string unit_name = System.IO.Path.GetFileNameWithoutExtension(FileName);
|
||||
pr = (PCUReader)units[unit_name];
|
||||
if (pr != null) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void CloseUnits()
|
||||
{
|
||||
AllReadOrWritedDefinitionNodesOffsets.Clear();
|
||||
|
|
@ -226,40 +218,69 @@ namespace PascalABCCompiler.PCU
|
|||
ReadPCUHeader();
|
||||
}
|
||||
|
||||
//десериализация модуля
|
||||
//читается только шапка PCU и заполняются имена сущностей модуля в таблицу символов
|
||||
public CompilationUnit GetCompilationUnit(string FileName, bool readDebugInfo)
|
||||
public string GetFullUnitName(string UnitName)
|
||||
{
|
||||
|
||||
var FullUnitName = comp.FindPCUFileName(UnitName, dir, out _);
|
||||
if (FullUnitName == null) throw new FileNotFound(UnitName, null);
|
||||
|
||||
return FullUnitName;
|
||||
}
|
||||
|
||||
private PCUReader GetPCUReaderForUnitId(int id)
|
||||
{
|
||||
if (id == -1) return this;
|
||||
string s = GetFullUnitName(pcu_file.incl_modules[id]);
|
||||
var pr = (PCUReader)units[s];
|
||||
if (pr == null)
|
||||
{
|
||||
pr = new PCUReader(this);
|
||||
pr.GetCompilationUnit(s, this.readDebugInfo);
|
||||
}
|
||||
return pr;
|
||||
}
|
||||
|
||||
//десериализация модуля
|
||||
//читается только шапка PCU и заполняются имена сущностей модуля в таблицу символов
|
||||
public CompilationUnit GetCompilationUnit(string FileName, bool readDebugInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Compiler.CombinePath всегда должно быть применено к имени файла, перед тем как кидать его сюда
|
||||
if (!Path.IsPathRooted(FileName)) throw new InvalidOperationException();
|
||||
|
||||
FileName = GetFullUnitName(FileName);
|
||||
dir = Path.GetDirectoryName(FileName);
|
||||
|
||||
this.FileName = FileName;
|
||||
this.readDebugInfo = readDebugInfo;
|
||||
unit_name = System.IO.Path.GetFileNameWithoutExtension(FileName);
|
||||
PCUReader pr = (PCUReader)units[unit_name];
|
||||
PCUReader pr = (PCUReader)units[FileName];
|
||||
if (pr != null) return pr.unit;
|
||||
if (!File.Exists(FileName)) return null;
|
||||
dir = System.IO.Path.GetDirectoryName(FileName);
|
||||
//fs = new FileStream(FileName, FileMode.Open, FileAccess.Read);
|
||||
ms = new MemoryStream(File.ReadAllBytes(FileName));
|
||||
br = new BinaryReader(ms);
|
||||
ReadPCUHeader();
|
||||
units[unit_name] = this;
|
||||
if (NeedRecompiled())
|
||||
{
|
||||
CloseUnit();
|
||||
need = true;
|
||||
return null; // return comp.RecompileUnit(unit_name);
|
||||
}
|
||||
units[FileName] = this;
|
||||
unit = new CompilationUnit();
|
||||
unit.UnitFileName = FileName;
|
||||
cun = new common_unit_node();
|
||||
cun.compiler_directives = pcu_file.compiler_directives;
|
||||
unit.SemanticTree = cun;
|
||||
if (NeedRecompiled())
|
||||
{
|
||||
CloseUnit();
|
||||
this.unit = null;
|
||||
need = true;
|
||||
return null; // return comp.RecompileUnit(FileName);
|
||||
}
|
||||
ChangeState(this, PCUReaderWriterState.BeginReadTree, unit);
|
||||
cun.scope = new WrappedUnitInterfaceScope(this);
|
||||
|
||||
//TODO сохранить в PCU
|
||||
cun.scope.CaseSensitive = false;
|
||||
if (string.Compare(unit_name,PascalABCCompiler.TreeConverter.compiler_string_consts.system_unit_file_name, true)==0)
|
||||
if (string.Compare(unit_name, compiler_string_consts.system_unit_file_name, true)==0)
|
||||
PascalABCCompiler.TreeConverter.syntax_tree_visitor.init_system_module(cun);
|
||||
//ssyy
|
||||
//Создаём область видимости для implementation - части
|
||||
|
|
@ -321,10 +342,10 @@ namespace PascalABCCompiler.PCU
|
|||
need = true;
|
||||
return need;
|
||||
}*/
|
||||
if (comp.NeedRecompiled(unit_name, Path.GetDirectoryName(FileName), pcu_file.incl_modules,this))
|
||||
if (comp.NeedRecompiled(FileName, pcu_file.incl_modules, this))
|
||||
{
|
||||
//comp.RecompileList.Add(unit_name,unit_name);
|
||||
comp.RecompileList[unit_name] = unit_name;
|
||||
comp.RecompileList[FileName] = FileName;
|
||||
need = true;
|
||||
return need;
|
||||
}
|
||||
|
|
@ -332,19 +353,24 @@ namespace PascalABCCompiler.PCU
|
|||
for (int i = 0; i < pcu_file.incl_modules.Length; i++)
|
||||
{
|
||||
//if (pcu_file.incl_modules[i].Contains("$"))
|
||||
// continue;
|
||||
string source_file_name = comp.FindSourceFileName(Path.Combine(dir, pcu_file.incl_modules[i]));
|
||||
if (source_file_name != null && comp.UnitTable[source_file_name] != null)
|
||||
return true;
|
||||
PCUReader pr = (PCUReader)units[pcu_file.incl_modules[i]];
|
||||
// continue;
|
||||
var used_unit_fname = comp.GetUnitFileName(Path.GetFileNameWithoutExtension(pcu_file.incl_modules[i]), pcu_file.incl_modules[i], dir, new SyntaxTree.SourceContext(0,0,0,0, FileName));
|
||||
if (Path.GetExtension(used_unit_fname) != comp.CompilerOptions.CompiledUnitExtension) return true;
|
||||
|
||||
PCUReader pr = (PCUReader)units[used_unit_fname];
|
||||
if (pr == null)
|
||||
pr = new PCUReader(this);
|
||||
pr.AddAlreadyCompiledUnit(FileName);
|
||||
if (used_units[pcu_file.incl_modules[i]] == null)
|
||||
if (used_units[used_unit_fname] == null)
|
||||
{
|
||||
used_units[pcu_file.incl_modules[i]] = used_units;
|
||||
if (already_compiled[pcu_file.incl_modules[i]] == null)
|
||||
pr.GetCompilationUnit(comp.FindPCUFileName(pcu_file.incl_modules[i], source_file_name), this.readDebugInfo);
|
||||
used_units[used_unit_fname] = used_units;
|
||||
if (already_compiled[used_unit_fname] == null)
|
||||
{
|
||||
var sub_u = pr.GetCompilationUnit(used_unit_fname, this.readDebugInfo);
|
||||
if (sub_u == null) return true;
|
||||
this.unit.DirectInterfaceCompilationUnits.Add(sub_u.SemanticTree, sub_u);
|
||||
this.unit.InterfaceUsedUnits.AddElement(sub_u.SemanticTree, pcu_file.incl_modules[i]);
|
||||
}
|
||||
}
|
||||
if (need == false) need = pr.need;
|
||||
}
|
||||
|
|
@ -414,7 +440,7 @@ namespace PascalABCCompiler.PCU
|
|||
private void AddNamespaces()
|
||||
{
|
||||
cun.unit_name=br.ReadString();
|
||||
|
||||
|
||||
common_namespace_node cnn = new common_namespace_node(null, cun, cun.unit_name, cun.scope, ReadDebugInfo());
|
||||
cun.namespaces.AddElement(cnn);
|
||||
|
||||
|
|
@ -585,7 +611,7 @@ namespace PascalABCCompiler.PCU
|
|||
pcu_file.compiler_directives = new List<compiler_directive>();
|
||||
for (int i = 0; i < num_directives; i++)
|
||||
{
|
||||
pcu_file.compiler_directives.Add(new compiler_directive(br.ReadString(),br.ReadString(),ReadDebugInfo()));
|
||||
pcu_file.compiler_directives.Add(new compiler_directive(br.ReadString(),br.ReadString(),ReadDebugInfo(), this.FileName));
|
||||
}
|
||||
ReadAllAssemblies();
|
||||
int num_imp_entity = br.ReadInt32();
|
||||
|
|
@ -989,45 +1015,17 @@ namespace PascalABCCompiler.PCU
|
|||
}
|
||||
|
||||
//получение импорт. типа
|
||||
private type_node ReadCommonExtType()
|
||||
{
|
||||
int pos = br.ReadInt32();
|
||||
string s = pcu_file.incl_modules[pos];
|
||||
PCUReader pr = (PCUReader)units[s];//вдруг этот модуль уже читается
|
||||
if (pr == null)//это по моему чёс, так как все модули уже добавлены
|
||||
{
|
||||
pr = new PCUReader(this);//если нет, то создаем ридер
|
||||
CompilationUnit cu = pr.GetCompilationUnit(dir + s + comp.CompilerOptions.CompiledUnitExtension, this.readDebugInfo);
|
||||
type_node tn = pr.GetTypeReference(br.ReadInt32());
|
||||
units[s] = pr;//добавляем в таблицу ридеров
|
||||
return tn;
|
||||
}
|
||||
else
|
||||
{
|
||||
type_node tn = pr.GetTypeReference(br.ReadInt32());
|
||||
return tn;
|
||||
}
|
||||
private type_node ReadCommonExtType()
|
||||
{
|
||||
var pr = GetPCUReaderForUnitId(br.ReadInt32());
|
||||
return pr.GetTypeReference(br.ReadInt32());
|
||||
}
|
||||
|
||||
//(ssyy) Получение шаблонного класса
|
||||
private template_class ReadTemplateExtClass()
|
||||
{
|
||||
int pos = br.ReadInt32();
|
||||
string s = pcu_file.incl_modules[pos];
|
||||
PCUReader pr = (PCUReader)units[s];//вдруг этот модуль уже читается
|
||||
if (pr == null)//это по моему чёс, так как все модули уже добавлены
|
||||
{
|
||||
pr = new PCUReader(this);//если нет, то создаем ридер
|
||||
CompilationUnit cu = pr.GetCompilationUnit(dir + s + comp.CompilerOptions.CompiledUnitExtension, this.readDebugInfo);
|
||||
template_class tc = pr.GetTemplateClass(br.ReadInt32());
|
||||
units[s] = pr;//добавляем в таблицу ридеров
|
||||
return tc;
|
||||
}
|
||||
else
|
||||
{
|
||||
template_class tc = pr.GetTemplateClass(br.ReadInt32());
|
||||
return tc;
|
||||
}
|
||||
var pr = GetPCUReaderForUnitId(br.ReadInt32());
|
||||
return pr.GetTemplateClass(br.ReadInt32());
|
||||
}
|
||||
|
||||
//получение откомпил. типа
|
||||
|
|
@ -1095,68 +1093,28 @@ namespace PascalABCCompiler.PCU
|
|||
ext_members[offset] = ctn;
|
||||
br.BaseStream.Seek(tmp,SeekOrigin.Begin);
|
||||
return ctn;
|
||||
}
|
||||
|
||||
//получение импортируемой функции
|
||||
private common_namespace_function_node ReadCommonExtNamespaceFunc()
|
||||
}
|
||||
|
||||
//получение импортируемой функции
|
||||
private common_namespace_function_node ReadCommonExtNamespaceFunc()
|
||||
{
|
||||
br.ReadByte();
|
||||
int pos = br.ReadInt32();
|
||||
string s = pcu_file.incl_modules[pos];
|
||||
PCUReader pr = (PCUReader)units[s];
|
||||
if (pr == null)
|
||||
{
|
||||
pr = new PCUReader(this);
|
||||
CompilationUnit cu = pr.GetCompilationUnit(dir + s + comp.CompilerOptions.CompiledUnitExtension, this.readDebugInfo);
|
||||
int offset = br.ReadInt32();
|
||||
common_namespace_function_node cffn = pr.GetNamespaceFunction(offset);
|
||||
return cffn;
|
||||
}
|
||||
else
|
||||
{
|
||||
common_namespace_function_node cffn = pr.GetNamespaceFunction(br.ReadInt32());
|
||||
return cffn;
|
||||
}
|
||||
var pr = GetPCUReaderForUnitId(br.ReadInt32());
|
||||
return pr.GetNamespaceFunction(br.ReadInt32());
|
||||
}
|
||||
|
||||
private namespace_variable ReadExtNamespaceVariable()
|
||||
{
|
||||
br.ReadByte();
|
||||
int pos = br.ReadInt32();
|
||||
string s = pcu_file.incl_modules[pos];
|
||||
PCUReader pr = (PCUReader)units[s];
|
||||
if (pr == null)
|
||||
{
|
||||
pr = new PCUReader(this);
|
||||
CompilationUnit cu = pr.GetCompilationUnit(dir + s + comp.CompilerOptions.CompiledUnitExtension, this.readDebugInfo);
|
||||
namespace_variable nv = pr.GetNamespaceVariable(br.ReadInt32());
|
||||
return nv;
|
||||
}
|
||||
else
|
||||
{
|
||||
namespace_variable nv = pr.GetNamespaceVariable(br.ReadInt32());
|
||||
return nv;
|
||||
}
|
||||
var pr = GetPCUReaderForUnitId(br.ReadInt32());
|
||||
return pr.GetNamespaceVariable(br.ReadInt32());
|
||||
}
|
||||
|
||||
private namespace_constant_definition ReadExtNamespaceConstant()
|
||||
{
|
||||
br.ReadByte();
|
||||
int pos = br.ReadInt32();
|
||||
string s = pcu_file.incl_modules[pos];
|
||||
PCUReader pr = (PCUReader)units[s];
|
||||
if (pr == null)
|
||||
{
|
||||
pr = new PCUReader(this);
|
||||
CompilationUnit cu = pr.GetCompilationUnit(dir + s + comp.CompilerOptions.CompiledUnitExtension, this.readDebugInfo);
|
||||
namespace_constant_definition nv = pr.GetConstantDefinition(br.ReadInt32());
|
||||
return nv;
|
||||
}
|
||||
else
|
||||
{
|
||||
namespace_constant_definition nv = pr.GetConstantDefinition(br.ReadInt32());
|
||||
return nv;
|
||||
}
|
||||
var pr = GetPCUReaderForUnitId(br.ReadInt32());
|
||||
return pr.GetConstantDefinition(br.ReadInt32());
|
||||
}
|
||||
|
||||
private common_namespace_event ReadCommonNamespaceExtEvent()
|
||||
|
|
@ -1166,22 +1124,9 @@ namespace PascalABCCompiler.PCU
|
|||
int tmp = (int)br.BaseStream.Position;
|
||||
br.BaseStream.Seek(ext_pos + offset, SeekOrigin.Begin);
|
||||
br.ReadByte();//DS Changed
|
||||
int pos = br.ReadInt32();
|
||||
string s = pcu_file.incl_modules[pos];
|
||||
PCUReader pr = (PCUReader)units[s];
|
||||
var pr = GetPCUReaderForUnitId(br.ReadInt32());
|
||||
br.BaseStream.Seek(tmp, SeekOrigin.Begin);
|
||||
if (pr == null)
|
||||
{
|
||||
pr = new PCUReader(this);
|
||||
CompilationUnit cu = pr.GetCompilationUnit(dir + s + comp.CompilerOptions.CompiledUnitExtension, this.readDebugInfo);
|
||||
common_namespace_event ev = pr.GetNamespaceEventNode(br.ReadInt32());
|
||||
return ev;
|
||||
}
|
||||
else
|
||||
{
|
||||
common_namespace_event ev = pr.GetNamespaceEventNode(br.ReadInt32());
|
||||
return ev;
|
||||
}
|
||||
return pr.GetNamespaceEventNode(br.ReadInt32());
|
||||
}
|
||||
|
||||
private common_event ReadCommonExtEvent()
|
||||
|
|
@ -1191,22 +1136,9 @@ namespace PascalABCCompiler.PCU
|
|||
int tmp = (int)br.BaseStream.Position;
|
||||
br.BaseStream.Seek(ext_pos + offset, SeekOrigin.Begin);
|
||||
br.ReadByte();//DS Changed
|
||||
int pos = br.ReadInt32();
|
||||
string s = pcu_file.incl_modules[pos];
|
||||
PCUReader pr = (PCUReader)units[s];
|
||||
var pr = GetPCUReaderForUnitId(br.ReadInt32());
|
||||
br.BaseStream.Seek(tmp, SeekOrigin.Begin);
|
||||
if (pr == null)
|
||||
{
|
||||
pr = new PCUReader(this);
|
||||
CompilationUnit cu = pr.GetCompilationUnit(dir + s + comp.CompilerOptions.CompiledUnitExtension, this.readDebugInfo);
|
||||
common_event ev = pr.GetEventNode(br.ReadInt32());
|
||||
return ev;
|
||||
}
|
||||
else
|
||||
{
|
||||
common_event ev = pr.GetEventNode(br.ReadInt32());
|
||||
return ev;
|
||||
}
|
||||
return pr.GetEventNode(br.ReadInt32());
|
||||
}
|
||||
|
||||
private class_field ReadCommonExtField()
|
||||
|
|
@ -1216,22 +1148,9 @@ namespace PascalABCCompiler.PCU
|
|||
int tmp = (int)br.BaseStream.Position;
|
||||
br.BaseStream.Seek(ext_pos + offset, SeekOrigin.Begin);
|
||||
br.ReadByte();//DS Changed
|
||||
int pos = br.ReadInt32();
|
||||
string s = pcu_file.incl_modules[pos];
|
||||
PCUReader pr = (PCUReader)units[s];
|
||||
var pr = GetPCUReaderForUnitId(br.ReadInt32());
|
||||
br.BaseStream.Seek(tmp, SeekOrigin.Begin);
|
||||
if (pr == null)
|
||||
{
|
||||
pr = new PCUReader(this);
|
||||
CompilationUnit cu = pr.GetCompilationUnit(dir + s + comp.CompilerOptions.CompiledUnitExtension, this.readDebugInfo);
|
||||
class_field field = pr.GetClassField(br.ReadInt32());
|
||||
return field;
|
||||
}
|
||||
else
|
||||
{
|
||||
class_field field = pr.GetClassField(br.ReadInt32());
|
||||
return field;
|
||||
}
|
||||
return pr.GetClassField(br.ReadInt32());
|
||||
}
|
||||
|
||||
private common_method_node ReadCommonExtMethod()
|
||||
|
|
@ -1241,22 +1160,9 @@ namespace PascalABCCompiler.PCU
|
|||
int tmp = (int)br.BaseStream.Position;
|
||||
br.BaseStream.Seek(ext_pos + offset, SeekOrigin.Begin);
|
||||
br.ReadByte();//DS Changed
|
||||
int pos = br.ReadInt32();
|
||||
string s = pcu_file.incl_modules[pos];
|
||||
PCUReader pr = (PCUReader)units[s];
|
||||
var pr = GetPCUReaderForUnitId(br.ReadInt32());
|
||||
br.BaseStream.Seek(tmp, SeekOrigin.Begin);
|
||||
if (pr == null)
|
||||
{
|
||||
pr = new PCUReader(this);
|
||||
CompilationUnit cu = pr.GetCompilationUnit(dir + s + comp.CompilerOptions.CompiledUnitExtension, this.readDebugInfo);
|
||||
common_method_node meth = pr.GetClassMethod(br.ReadInt32());
|
||||
return meth;
|
||||
}
|
||||
else
|
||||
{
|
||||
common_method_node meth = pr.GetClassMethod(br.ReadInt32());
|
||||
return meth;
|
||||
}
|
||||
return pr.GetClassMethod(br.ReadInt32());
|
||||
}
|
||||
|
||||
private common_property_node ReadCommonExtProperty()
|
||||
|
|
@ -1266,22 +1172,9 @@ namespace PascalABCCompiler.PCU
|
|||
int tmp = (int)br.BaseStream.Position;
|
||||
br.BaseStream.Seek(ext_pos + offset, SeekOrigin.Begin);
|
||||
br.ReadByte();//DS Changed
|
||||
int pos = br.ReadInt32();
|
||||
string s = pcu_file.incl_modules[pos];
|
||||
PCUReader pr = (PCUReader)units[s];
|
||||
var pr = GetPCUReaderForUnitId(br.ReadInt32());
|
||||
br.BaseStream.Seek(tmp, SeekOrigin.Begin);
|
||||
if (pr == null)
|
||||
{
|
||||
pr = new PCUReader(this);
|
||||
CompilationUnit cu = pr.GetCompilationUnit(dir + s + comp.CompilerOptions.CompiledUnitExtension, this.readDebugInfo);
|
||||
common_property_node prop = pr.GetPropertyNode(br.ReadInt32());
|
||||
return prop;
|
||||
}
|
||||
else
|
||||
{
|
||||
common_property_node prop = pr.GetPropertyNode(br.ReadInt32());
|
||||
return prop;
|
||||
}
|
||||
return pr.GetPropertyNode(br.ReadInt32());
|
||||
}
|
||||
|
||||
//получение типа, описанного в этом модуле (может вызываться извне)
|
||||
|
|
@ -2524,7 +2417,7 @@ namespace PascalABCCompiler.PCU
|
|||
//Добавляем подключенные модули
|
||||
for (int i = 0; i < uses_count; i++)
|
||||
{
|
||||
PCUReader pcu_r = units[pcu_file.incl_modules[i]] as PCUReader;
|
||||
PCUReader pcu_r = units[GetFullUnitName(pcu_file.incl_modules[i])] as PCUReader;
|
||||
if (pcu_r != null)
|
||||
{
|
||||
top_scopes.Add(pcu_r.cun.scope);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ using TreeConverter;
|
|||
using PascalABCCompiler.TreeConverter;
|
||||
using PascalABCCompiler.TreeRealization;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Linq;
|
||||
|
||||
namespace PascalABCCompiler.PCU
|
||||
{
|
||||
public class PCUConsts
|
||||
|
|
@ -213,7 +214,7 @@ namespace PascalABCCompiler.PCU
|
|||
private List<string> ref_assemblies = new List<string>();//список подключаемых сборок, заполняется в процессе
|
||||
private Dictionary<Assembly,int> assm_refs = new Dictionary<Assembly,int>();//таблица для привязывания сборки
|
||||
private Dictionary<definition_node, int> func_codes = new Dictionary<definition_node, int>();//таблица, хранящая смещения тел методов в PCU
|
||||
private Dictionary<definition_node, int> used_units = new Dictionary<definition_node, int>();
|
||||
private Dictionary<common_unit_node, int> used_units = new Dictionary<common_unit_node, int>();
|
||||
private Dictionary<definition_node,ImportedEntity> ext_members = new Dictionary<definition_node,ImportedEntity>();//таблица, привязывающая импорт. сущность с записью в списке имп. сущ-тей
|
||||
private common_namespace_node cur_cnn;//текущее пространство имен
|
||||
private bool is_interface = true;//переводим ли интерфейсную часть
|
||||
|
|
@ -876,12 +877,15 @@ namespace PascalABCCompiler.PCU
|
|||
if (tn is common_type_node)
|
||||
{
|
||||
common_namespace_node comp_cnn = (tn as common_type_node).comprehensive_namespace;
|
||||
if (comp_cnn != null && !ns_dict.ContainsKey(comp_cnn))
|
||||
if (comp_cnn != null && !ns_dict.ContainsKey(comp_cnn) && unit.SemanticTree != comp_cnn.cont_unit)
|
||||
{
|
||||
var path = Compiler.GetUnitPath(unit, compiler.UnitsSortedList.Find(u => u.SemanticTree == comp_cnn.cont_unit));
|
||||
|
||||
if (interf)
|
||||
unit.InterfaceUsedUnits.AddElement(comp_cnn.cont_unit);
|
||||
unit.InterfaceUsedUnits.AddElement(comp_cnn.cont_unit, path);
|
||||
else
|
||||
unit.ImplementationUsedUnits.AddElement(comp_cnn.cont_unit);
|
||||
unit.ImplementationUsedUnits.AddElement(comp_cnn.cont_unit, path);
|
||||
|
||||
ns_dict[comp_cnn] = true;
|
||||
}
|
||||
if (tn.base_type is common_type_node)
|
||||
|
|
@ -1034,79 +1038,52 @@ namespace PascalABCCompiler.PCU
|
|||
//заполнение списка подключаемых модулей
|
||||
private void GetUsedUnits()
|
||||
{
|
||||
int num = 0;
|
||||
common_unit_node unt = null;
|
||||
AddIndirectInteraceUsedUnits();
|
||||
AddIndirectImplementationUsedUnits();
|
||||
for (int j = 0; j < unit.InterfaceUsedUnits.Count; j++)
|
||||
AddIndirectImplementationUsedUnits();
|
||||
|
||||
var c1 = unit.InterfaceUsedUnits.unit_uses_paths.Count;
|
||||
var c2 = unit.ImplementationUsedUnits.unit_uses_paths.Count;
|
||||
pcu_file.interface_uses_count = c1;
|
||||
|
||||
var incl_modules = new List<string>(c1 + c2);
|
||||
foreach (var used_unit in unit.InterfaceUsedUnits.OfType<common_unit_node>())
|
||||
{
|
||||
unt = unit.InterfaceUsedUnits[j] as common_unit_node;
|
||||
if (unt == null) continue;
|
||||
if (unt.namespaces.Count != 0)
|
||||
num += 1;//unt.namespaces.Count;
|
||||
// Каждый модуль, зачем то, подключён сам к себе
|
||||
// Конечно, записи в unit_uses_paths для такого подключения - нет
|
||||
if (unit.SemanticTree == used_unit) continue;
|
||||
|
||||
// AddIndirectInteraceUsedUnits может добавлять один и тот же модуль несколько раз
|
||||
if (used_units.ContainsKey(used_unit)) continue;
|
||||
|
||||
// раньше вместо пути модуля - брало имя его первого пространства имён
|
||||
// и сразу стояла эта проверка. Если будет тут вылетать - наверное надо заменить throw на continue
|
||||
if (used_unit.namespaces.Count == 0) throw new InvalidOperationException();
|
||||
|
||||
this.used_units.Add(used_unit, used_units.Count);
|
||||
incl_modules.Add(unit.InterfaceUsedUnits.unit_uses_paths[used_unit]);
|
||||
|
||||
}
|
||||
for (int j = 0; j < unit.ImplementationUsedUnits.Count; j++)
|
||||
{
|
||||
unt = unit.ImplementationUsedUnits[j] as common_unit_node;
|
||||
if (unt == null) continue;
|
||||
if (unt.namespaces.Count != 0)
|
||||
num += 1;//unt.namespaces.Count;
|
||||
foreach (var used_unit in unit.ImplementationUsedUnits.OfType<common_unit_node>())
|
||||
{
|
||||
if (unit.SemanticTree == used_unit) continue;
|
||||
if (used_units.ContainsKey(used_unit)) continue;
|
||||
if (used_unit.namespaces.Count == 0) throw new InvalidOperationException();
|
||||
|
||||
this.used_units.Add(used_unit, used_units.Count);
|
||||
incl_modules.Add(unit.ImplementationUsedUnits.unit_uses_paths[used_unit]);
|
||||
|
||||
}
|
||||
|
||||
pcu_file.incl_modules = new string[num];
|
||||
int i = 0; num = 0;
|
||||
for (i=0; i<unit.InterfaceUsedUnits.Count; i++)
|
||||
{
|
||||
unt = unit.InterfaceUsedUnits[i] as common_unit_node;
|
||||
if (unt == null) continue;
|
||||
if (unt.namespaces.Count != 0)
|
||||
{
|
||||
pcu_file.incl_modules[num] = unt.namespaces[0].namespace_name;
|
||||
used_units[unt.namespaces[0]] = num;
|
||||
num++;
|
||||
/*if (unt.namespaces.Count > 1)
|
||||
{
|
||||
pcu_file.incl_modules[num] = unt.namespaces[1].namespace_name;
|
||||
used_units[unt.namespaces[1]] = num;
|
||||
num++;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
//(ssyy) Запомнили, какие модули относятся к секции interface
|
||||
pcu_file.interface_uses_count = num;
|
||||
used_units.Add(unit.SemanticTree as common_unit_node, -1);
|
||||
|
||||
for (int j=0; j<unit.ImplementationUsedUnits.Count; j++)
|
||||
{
|
||||
unt = unit.ImplementationUsedUnits[j] as common_unit_node;
|
||||
if (unt == null) continue;
|
||||
if (unt.namespaces.Count != 0)
|
||||
{
|
||||
pcu_file.incl_modules[num] = unt.namespaces[0].namespace_name;
|
||||
used_units[unt.namespaces[0]] = num;
|
||||
num++;
|
||||
/*if (unt.namespaces.Count > 1)
|
||||
{
|
||||
pcu_file.incl_modules[num] = unt.namespaces[1].namespace_name;
|
||||
used_units[unt.namespaces[1]] = num;
|
||||
num++;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pcu_file.used_namespaces = cun.used_namespaces.ToArray();
|
||||
pcu_file.incl_modules = incl_modules.ToArray();
|
||||
pcu_file.used_namespaces = cun.used_namespaces.ToArray();
|
||||
}
|
||||
|
||||
//получения индекса модуля в списке подключ. модулей
|
||||
private int GetUnitToken(common_namespace_node ns)
|
||||
{
|
||||
int tok = 0;
|
||||
if (!used_units.TryGetValue(ns,out tok))
|
||||
{
|
||||
return used_units[(ns.cont_unit as common_unit_node).namespaces[0]];
|
||||
}
|
||||
return tok;
|
||||
return used_units[ns.cont_unit as common_unit_node];
|
||||
}
|
||||
|
||||
private int GetTokenForNetEntity(FieldInfo val)
|
||||
|
|
@ -1728,7 +1705,7 @@ namespace PascalABCCompiler.PCU
|
|||
is_def = 1;
|
||||
return off;//возвращаем его смещение
|
||||
}
|
||||
if (!used_units.ContainsKey(nv.namespace_node))
|
||||
if (!used_units.ContainsKey(nv.namespace_node.cont_unit as common_unit_node))
|
||||
{
|
||||
is_def = 1;
|
||||
return -1;
|
||||
|
|
@ -1758,7 +1735,7 @@ namespace PascalABCCompiler.PCU
|
|||
is_def = 1;
|
||||
return off;//возвращаем его смещение
|
||||
}
|
||||
if (!used_units.ContainsKey(nv.comprehensive_namespace))
|
||||
if (!used_units.ContainsKey(nv.comprehensive_namespace.cont_unit as common_unit_node))
|
||||
{
|
||||
is_def = 1;
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -11288,6 +11288,9 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
}
|
||||
}
|
||||
|
||||
// имя модуля в случае обычного uses
|
||||
// или путь к модулю в случае uses-in
|
||||
public virtual string UsesPath() => name.idents[0].name;
|
||||
|
||||
/// <summary> Создает копию узла </summary>
|
||||
public override syntax_tree_node Clone()
|
||||
|
|
@ -11456,9 +11459,10 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
if (_in_file != null)
|
||||
_in_file.Parent = this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override string UsesPath() => in_file.Value;
|
||||
|
||||
/// <summary> Создает копию узла </summary>
|
||||
public override syntax_tree_node Clone()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
unit u2;
|
||||
|
||||
{$savepcu false}
|
||||
|
||||
end.
|
||||
|
|
@ -1,7 +1,10 @@
|
|||
unit u1;
|
||||
|
||||
{$savepcu false}
|
||||
|
||||
uses u2 in '2\u2.pas';
|
||||
uses u3;
|
||||
uses u4;
|
||||
|
||||
{$include test.h}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
unit u3;
|
||||
|
||||
{$savepcu false}
|
||||
|
||||
end.
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
unit u4;
|
||||
|
||||
{$savepcu false}
|
||||
|
||||
{$include test.h}
|
||||
|
||||
begin
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
unit u0;
|
||||
|
||||
{$savepcu false}
|
||||
|
||||
uses u1;
|
||||
uses u2 in '..\UsesInUnits2_F2\u2.pas';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
unit u1;
|
||||
|
||||
{$savepcu false}
|
||||
|
||||
end.
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
unit u2;
|
||||
|
||||
{$savepcu false}
|
||||
|
||||
end.
|
||||
1
TestSuite/usesunits/UsesInUnits3/1.txt
Normal file
1
TestSuite/usesunits/UsesInUnits3/1.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
abc
|
||||
10
TestSuite/usesunits/UsesInUnits3/u.pas
Normal file
10
TestSuite/usesunits/UsesInUnits3/u.pas
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
unit u;
|
||||
|
||||
{$savepcu false}
|
||||
|
||||
{$resource '1.txt'}
|
||||
{$reference 'uui3_lib.dll'}
|
||||
|
||||
begin
|
||||
Assert('abc' = System.IO.StreamReader.Create(GetResourceStream('1.txt')).ReadToEnd);
|
||||
end.
|
||||
BIN
TestSuite/usesunits/UsesInUnits3/uui3_lib.dll
Normal file
BIN
TestSuite/usesunits/UsesInUnits3/uui3_lib.dll
Normal file
Binary file not shown.
3
TestSuite/usesunits/UsesInUnits3/uui3_lib.pas
Normal file
3
TestSuite/usesunits/UsesInUnits3/uui3_lib.pas
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
library uui3_lib;
|
||||
|
||||
end.
|
||||
12
TestSuite/usesunits/UsesInUnits4/u2.pas
Normal file
12
TestSuite/usesunits/UsesInUnits4/u2.pas
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
unit u2;
|
||||
{$savepcu false}
|
||||
|
||||
interface
|
||||
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses uses_in4_cycle_uses in '..\uses_in4_cycle_uses';
|
||||
|
||||
end.
|
||||
3
TestSuite/usesunits/uses_in1.pas
Normal file
3
TestSuite/usesunits/uses_in1.pas
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
uses u1 in 'UsesInUnits\u1.pas';
|
||||
|
||||
begin end.
|
||||
3
TestSuite/usesunits/uses_in2.pas
Normal file
3
TestSuite/usesunits/uses_in2.pas
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
uses u0 in 'UsesInUnits2\u0.pas';
|
||||
|
||||
begin end.
|
||||
3
TestSuite/usesunits/uses_in3_derectives.pas
Normal file
3
TestSuite/usesunits/uses_in3_derectives.pas
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
uses u in 'UsesInUnits3\u';
|
||||
|
||||
begin end.
|
||||
12
TestSuite/usesunits/uses_in4_cycle_uses.pas
Normal file
12
TestSuite/usesunits/uses_in4_cycle_uses.pas
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
unit uses_in4_cycle_uses;
|
||||
{$savepcu false}
|
||||
|
||||
interface
|
||||
|
||||
uses u2 in 'UsesInUnits4\u2';
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
|
||||
end.
|
||||
|
|
@ -10926,7 +10926,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
System.Collections.Generic.List<compiler_directive> list = new System.Collections.Generic.List<compiler_directive>();
|
||||
foreach (SyntaxTree.compiler_directive sncd in cu.compiler_directives)
|
||||
{
|
||||
list.Add(new compiler_directive(sncd.Name.text, sncd.Directive!=null?sncd.Directive.text:"", get_location(sncd)));
|
||||
list.Add(new compiler_directive(sncd.Name.text, sncd.Directive!=null?sncd.Directive.text:"", get_location(sncd), cu.file_name));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
using System;
|
||||
|
||||
using PascalABCCompiler.Collections;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using PascalABCCompiler.Collections;
|
||||
|
||||
namespace PascalABCCompiler.TreeRealization
|
||||
{
|
||||
/// <summary>
|
||||
|
|
@ -104,7 +104,28 @@ namespace PascalABCCompiler.TreeRealization
|
|||
/// </summary>
|
||||
[Serializable]
|
||||
public class unit_node_list : extended_collection<unit_node>
|
||||
{
|
||||
{
|
||||
public Dictionary<unit_node, string> unit_uses_paths = new Dictionary<unit_node, string>();
|
||||
|
||||
public new void AddElement(unit_node unit)
|
||||
{
|
||||
throw new InvalidOperationException("Use second overload of \"unit_node_list.AddElement\"");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds element to the "uses" list
|
||||
/// </summary>
|
||||
/// <param name="unit">Element to add. Can be unit, namespace, .dll reference, etc.</param>
|
||||
/// <param name="unit_uses_path">Path to unit. Can be relative string, null for non-pascal_unit's</param>
|
||||
/// <returns>Returns true if new pascal unit (not .dll, namespace, etc.) was added</returns>
|
||||
public bool AddElement(unit_node unit, string unit_uses_path)
|
||||
{
|
||||
if (unit_uses_paths.ContainsKey(unit)) return false;
|
||||
base.AddElement(unit);
|
||||
if (unit_uses_path != null) unit_uses_paths.Add(unit, unit_uses_path);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -10,12 +10,15 @@ namespace PascalABCCompiler.TreeRealization
|
|||
{
|
||||
public string name;
|
||||
public string directive;
|
||||
public location location;
|
||||
public compiler_directive(string name,string directive,location loc)
|
||||
public location location;
|
||||
public string source_file; // Файл из которого загрузили директиву. В отличии от location - может указывать на .pcu
|
||||
|
||||
public compiler_directive(string name, string directive, location loc, string source_file)
|
||||
{
|
||||
this.name = name;
|
||||
this.directive = directive;
|
||||
this.location = loc;
|
||||
this.source_file = source_file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
}
|
||||
|
||||
[Serializable]
|
||||
public class common_unit_node : unit_node
|
||||
public sealed class common_unit_node : unit_node
|
||||
{
|
||||
private readonly common_namespace_node_list _namespaces = new common_namespace_node_list();
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
|
||||
private common_namespace_function_node _main_function;
|
||||
private common_namespace_function_node _finalization_method;
|
||||
private string _unit_name;
|
||||
public string unit_name { get; set; }
|
||||
|
||||
internal common_parameter MainArgsParameter = null;
|
||||
internal expression_node MainArgsAssignExpr = null;
|
||||
|
|
@ -154,7 +154,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
|
||||
public common_unit_node(string name)
|
||||
{
|
||||
_unit_name = name;
|
||||
this.unit_name = name;
|
||||
}
|
||||
|
||||
public void add_unit_name_to_namespace()
|
||||
|
|
@ -162,18 +162,6 @@ namespace PascalABCCompiler.TreeRealization
|
|||
this.scope.AddSymbol(unit_name, new TreeConverter.SymbolInfo(this));
|
||||
}
|
||||
|
||||
public string unit_name
|
||||
{
|
||||
get
|
||||
{
|
||||
return _unit_name;
|
||||
}
|
||||
set
|
||||
{
|
||||
_unit_name = value;
|
||||
}
|
||||
}
|
||||
|
||||
public common_namespace_function_node main_function
|
||||
{
|
||||
get
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ FILE_{0}_NOT_FOUND=File '{0}' not found
|
|||
NAMESPACE_CAN_BE_COMPILED_ONLY_IN_PROJECTS=Files with namespaces can be compiled only inside projects
|
||||
NAMESPACE_CANNOT_HAVE_IN_SECTION=Namespace cannot have 'in' section
|
||||
APPTYPE_DLL_IS_ALLOWED_ONLY_FOR_LIBRARIES= {$apptype dll} directive is allowed only for libraries
|
||||
USES_IN_WRONG_NAME=Unit name in uses-in ({0}) must be same as file name ({1})
|
||||
|
||||
%PREFIX%=
|
||||
COMPILER_INTERNAL_ERROR_IN_UNIT_{0}_:{1}=Internal compiler error in module {0} :'{1}'
|
||||
|
|
@ -18,6 +18,7 @@ NAMESPACE_CAN_BE_COMPILED_ONLY_IN_PROJECTS=Компиляция файлов с
|
|||
FILE_{0}_NOT_FOUND=Файл '{0}' не найден
|
||||
NAMESPACE_CANNOT_HAVE_IN_SECTION=Для пространства имен не может указываться секция in
|
||||
APPTYPE_DLL_IS_ALLOWED_ONLY_FOR_LIBRARIES=Директива {$apptype dll} возможна только для библиотек
|
||||
USES_IN_WRONG_NAME=Имя модуля в uses-in ({0}) должно совпадать с именем файла ({1})
|
||||
|
||||
%PREFIX%=
|
||||
COMPILER_INTERNAL_ERROR_IN_UNIT_{0}_:{1}=Внутренняя ошибка компилятора в модуле {0} :'{1}'
|
||||
|
|
@ -16,6 +16,7 @@ MAINRESOURCE_NOT_ALLOWED=Неприпустимо сумісне викорис
|
|||
DUPLICATE_DIRECTIVE{0}=Повторное объявление директивы {0}
|
||||
FILE_{0}_NOT_FOUND=Файл '{0}' не знайдено
|
||||
NAMESPACE_CAN_BE_COMPILED_ONLY_IN_PROJECTS=Компиляция файлов с пространствами имен допустима только в проектах
|
||||
USES_IN_WRONG_NAME=Ім'я модуля в uses-in ({0}) має збігатися з ім'ям файлу ({1})
|
||||
|
||||
%PREFIX%=
|
||||
COMPILER_INTERNAL_ERROR_IN_UNIT_{0}_:{1}=Внутрішня помилка компілятора в модулі {0} :'{1}'
|
||||
Loading…
Reference in a new issue