bug fix
This commit is contained in:
parent
948632cb43
commit
01efad3d4f
|
|
@ -477,9 +477,10 @@ namespace PascalABCCompiler.PCU
|
||||||
type_node tn = GetSpecialTypeReference(names[i].offset);
|
type_node tn = GetSpecialTypeReference(names[i].offset);
|
||||||
if (tn is compiled_type_node)
|
if (tn is compiled_type_node)
|
||||||
{
|
{
|
||||||
if ((tn as compiled_type_node).scope == null)
|
compiled_type_node ctn = tn as compiled_type_node;
|
||||||
(tn as compiled_type_node).init_scope();
|
if (ctn.scope == null)
|
||||||
(tn as compiled_type_node).scope.AddSymbol(names[i].name, si);
|
ctn.init_scope();
|
||||||
|
ctn.scope.AddSymbol(names[i].name, si);
|
||||||
}
|
}
|
||||||
else if (tn is generic_instance_type_node)
|
else if (tn is generic_instance_type_node)
|
||||||
tn.Scope.AddSymbol(names[i].name, si);
|
tn.Scope.AddSymbol(names[i].name, si);
|
||||||
|
|
@ -2532,12 +2533,6 @@ namespace PascalABCCompiler.PCU
|
||||||
private void RestoreAllFields(common_type_node ctn)
|
private void RestoreAllFields(common_type_node ctn)
|
||||||
{
|
{
|
||||||
//восстанавливаем все методы
|
//восстанавливаем все методы
|
||||||
|
|
||||||
//(ssyy) Внимание!!! Данный код удваивает все методы!
|
|
||||||
//Я изменил его.
|
|
||||||
//DarkStar - посмотри: NETGenerator после этого кода
|
|
||||||
//дважды переводит каждую функцию.
|
|
||||||
//DarkStar: Да, Ты прав!. Метод я переписал.
|
|
||||||
string[] mnames = class_names[ctn];
|
string[] mnames = class_names[ctn];
|
||||||
WrappedClassScope wcs = ctn.scope as WrappedClassScope;
|
WrappedClassScope wcs = ctn.scope as WrappedClassScope;
|
||||||
foreach (string mname in mnames)
|
foreach (string mname in mnames)
|
||||||
|
|
@ -2908,10 +2903,6 @@ namespace PascalABCCompiler.PCU
|
||||||
for (int i=0; i<num_nest_funcs; i++)
|
for (int i=0; i<num_nest_funcs; i++)
|
||||||
cnfn.functions_nodes_list.AddElement(GetNestedFunction());
|
cnfn.functions_nodes_list.AddElement(GetNestedFunction());
|
||||||
//br.ReadInt32();//code;
|
//br.ReadInt32();//code;
|
||||||
if (cnfn.name == "*")
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
cnfn.loc = ReadDebugInfo();
|
cnfn.loc = ReadDebugInfo();
|
||||||
cnfn.function_code = (restore_code /*|| cnfn.is_generic_function*/) ? GetCode(br.ReadInt32()) : new wrapped_function_body(this, br.ReadInt32());
|
cnfn.function_code = (restore_code /*|| cnfn.is_generic_function*/) ? GetCode(br.ReadInt32()) : new wrapped_function_body(this, br.ReadInt32());
|
||||||
cnfn.ConnectedToType = ConnectedToType;
|
cnfn.ConnectedToType = ConnectedToType;
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,26 @@ type
|
||||||
end;
|
end;
|
||||||
protected property VisualChildrenCount: integer read getVisualChildrenCount; override;
|
protected property VisualChildrenCount: integer read getVisualChildrenCount; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TBaseClass = class
|
||||||
|
function getA: integer;
|
||||||
|
begin
|
||||||
|
Result := 1;
|
||||||
|
end;
|
||||||
|
public property A: integer read getA; virtual;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TDerClass = class(TBaseClass)
|
||||||
|
function getA: integer;
|
||||||
|
begin
|
||||||
|
Result := 2;
|
||||||
|
end;
|
||||||
|
public property A: integer read getA; override;
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
var obj: MyVisualHostBase := new MyVisualHost;
|
var obj: MyVisualHostBase := new MyVisualHost;
|
||||||
assert(obj.getCnt=1);
|
assert(obj.getCnt=1);
|
||||||
|
var obj2: TBaseClass := new TDerClass;
|
||||||
|
assert(obj2.A = 2);
|
||||||
end.
|
end.
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
//winonly
|
//winonly
|
||||||
|
{$reference 'PresentationFramework.dll'}
|
||||||
|
{$reference 'WindowsBase.dll'}
|
||||||
|
{$reference 'PresentationCore.dll'}
|
||||||
|
{$reference 'WindowsFormsIntegration.dll'}
|
||||||
uses System, System.Windows, System.Collections, System.Collections.Generic;
|
uses System, System.Windows, System.Collections, System.Collections.Generic;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|
|
||||||
|
|
@ -253,7 +253,7 @@ namespace PascalABCCompiler.NetHelper
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class NetHelper {
|
public static class NetHelper {
|
||||||
private static Hashtable namespaces;
|
private static Hashtable namespaces;
|
||||||
private static Hashtable types;
|
private static Hashtable types;
|
||||||
private static Dictionary<string,FoundInfo> type_search_cache;
|
private static Dictionary<string,FoundInfo> type_search_cache;
|
||||||
private static Hashtable compiled_pascal_types;
|
private static Hashtable compiled_pascal_types;
|
||||||
|
|
@ -433,12 +433,12 @@ namespace PascalABCCompiler.NetHelper
|
||||||
//if (namespaces[s] == null) ns_ht.Add(s,s);
|
//if (namespaces[s] == null) ns_ht.Add(s,s);
|
||||||
ns_ht[s] = s;
|
ns_ht[s] = s;
|
||||||
namespaces[s] = t;
|
namespaces[s] = t;
|
||||||
|
|
||||||
if (pos != -1)
|
if (pos != -1)
|
||||||
{
|
{
|
||||||
string[] sub_ns_arr = s.Split('.');
|
string[] sub_ns_arr = s.Split('.');
|
||||||
string sub_ns_str = sub_ns_arr[sub_ns_arr.Length - 1];
|
string sub_ns_str = sub_ns_arr[sub_ns_arr.Length - 1];
|
||||||
namespaces[sub_ns_str] = t;
|
namespaces[sub_ns_str] = t;
|
||||||
|
ns_ht[sub_ns_str] = s;
|
||||||
int ind = sub_ns_arr.Length - 2;
|
int ind = sub_ns_arr.Length - 2;
|
||||||
while (ind != 0)
|
while (ind != 0)
|
||||||
{
|
{
|
||||||
|
|
@ -452,10 +452,8 @@ namespace PascalABCCompiler.NetHelper
|
||||||
pos = s.LastIndexOf('.');
|
pos = s.LastIndexOf('.');
|
||||||
//if (pos == -1)
|
//if (pos == -1)
|
||||||
if (namespaces[s] == null)
|
if (namespaces[s] == null)
|
||||||
{
|
|
||||||
ns_ht.Add(s, s);
|
|
||||||
namespaces[s] = t;
|
namespaces[s] = t;
|
||||||
}
|
ns_ht[s] = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TypeInfo ti = new TypeInfo(t, t.FullName);
|
TypeInfo ti = new TypeInfo(t, t.FullName);
|
||||||
|
|
@ -821,7 +819,8 @@ namespace PascalABCCompiler.NetHelper
|
||||||
|
|
||||||
if (t != null && cur_used_assemblies.ContainsKey(t.Assembly)) return true;
|
if (t != null && cur_used_assemblies.ContainsKey(t.Assembly)) return true;
|
||||||
foreach (Assembly a in namespace_assemblies.Keys)
|
foreach (Assembly a in namespace_assemblies.Keys)
|
||||||
if (cur_used_assemblies.ContainsKey(a) && (namespace_assemblies[a] as Hashtable).ContainsKey(Namespace)) return true;
|
if (cur_used_assemblies.ContainsKey(a) && (namespace_assemblies[a] as Hashtable).ContainsKey(Namespace))
|
||||||
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue