fix #1665
This commit is contained in:
parent
323db9e66d
commit
00e9cf8078
|
|
@ -2180,10 +2180,12 @@ namespace PascalABCCompiler.PCU
|
|||
{
|
||||
bw.Write(cur_cnn.non_template_types.Count);
|
||||
for (int i=0; i<cur_cnn.non_template_types.Count; i++)
|
||||
if (cur_cnn.non_template_types[i].type_special_kind != SemanticTree.type_special_kind.array_wrapper)
|
||||
VisitTypeDefinition(cur_cnn.non_template_types[i]);
|
||||
if (!(cur_cnn.non_template_types[i].type_special_kind == SemanticTree.type_special_kind.array_wrapper &&
|
||||
cur_cnn.non_template_types[i].name.StartsWith("$") && cur_cnn.non_template_types[i].element_type is common_type_node && cur_cnn.non_template_types[i].element_type.is_class))
|
||||
VisitTypeDefinition(cur_cnn.non_template_types[i]);
|
||||
for (int i = 0; i < cur_cnn.non_template_types.Count; i++)
|
||||
if (cur_cnn.non_template_types[i].type_special_kind == SemanticTree.type_special_kind.array_wrapper)
|
||||
if (cur_cnn.non_template_types[i].type_special_kind == SemanticTree.type_special_kind.array_wrapper &&
|
||||
cur_cnn.non_template_types[i].name.StartsWith("$") && cur_cnn.non_template_types[i].element_type is common_type_node && cur_cnn.non_template_types[i].element_type.is_class)
|
||||
VisitTypeDefinition(cur_cnn.non_template_types[i]);
|
||||
bw.Write(cur_cnn.runtime_types.Count);
|
||||
for (int i=0; i<cur_cnn.runtime_types.Count; i++)
|
||||
|
|
|
|||
|
|
@ -597,12 +597,15 @@ begin
|
|||
if str = nil then raise new FileNotOpenedException(fi.FullName);
|
||||
var a := new byte[sz];
|
||||
var gc_hnd := GCHandle.Alloc(a, GCHandleType.Pinned);
|
||||
System.Buffer.MemoryCopy(
|
||||
@o,
|
||||
gc_hnd.AddrOfPinnedObject.ToPointer,
|
||||
sz,sz
|
||||
);
|
||||
gc_hnd.Free;
|
||||
try
|
||||
System.Buffer.MemoryCopy(
|
||||
@o,
|
||||
gc_hnd.AddrOfPinnedObject.ToPointer,
|
||||
sz,sz
|
||||
);
|
||||
finally
|
||||
gc_hnd.Free;
|
||||
end;
|
||||
bw.Write(a);
|
||||
end;
|
||||
|
||||
|
|
@ -614,14 +617,20 @@ begin
|
|||
var bl := sz*o.Length;
|
||||
var a := new byte[bl];
|
||||
var gc_hnd1 := GCHandle.Alloc(o, GCHandleType.Pinned);
|
||||
var gc_hnd2 := GCHandle.Alloc(a, GCHandleType.Pinned);
|
||||
System.Buffer.MemoryCopy(
|
||||
gc_hnd1.AddrOfPinnedObject.ToPointer,
|
||||
gc_hnd2.AddrOfPinnedObject.ToPointer,
|
||||
bl,bl
|
||||
);
|
||||
gc_hnd1.Free;
|
||||
gc_hnd2.Free;
|
||||
try
|
||||
var gc_hnd2 := GCHandle.Alloc(a, GCHandleType.Pinned);
|
||||
try
|
||||
System.Buffer.MemoryCopy(
|
||||
gc_hnd1.AddrOfPinnedObject.ToPointer,
|
||||
gc_hnd2.AddrOfPinnedObject.ToPointer,
|
||||
bl,bl
|
||||
);
|
||||
finally
|
||||
gc_hnd2.Free;
|
||||
end;
|
||||
finally
|
||||
gc_hnd1.Free;
|
||||
end;
|
||||
bw.Write(a);
|
||||
end;
|
||||
|
||||
|
|
@ -639,17 +648,20 @@ begin
|
|||
|
||||
var a := new byte[sz*o.Count];
|
||||
var gc_hnd := GCHandle.Alloc(a, GCHandleType.Pinned);
|
||||
var hnd := gc_hnd.AddrOfPinnedObject;
|
||||
foreach var el in o do
|
||||
begin
|
||||
System.Buffer.MemoryCopy(
|
||||
@el,
|
||||
hnd.ToPointer,
|
||||
sz,sz
|
||||
);
|
||||
System.IntPtr.Add(hnd, sz);
|
||||
try
|
||||
var hnd := gc_hnd.AddrOfPinnedObject;
|
||||
foreach var el in o do
|
||||
begin
|
||||
System.Buffer.MemoryCopy(
|
||||
@el,
|
||||
hnd.ToPointer,
|
||||
sz,sz
|
||||
);
|
||||
System.IntPtr.Add(hnd, sz);
|
||||
end;
|
||||
finally
|
||||
gc_hnd.Free;
|
||||
end;
|
||||
gc_hnd.Free;
|
||||
bw.Write(a);
|
||||
end;
|
||||
|
||||
|
|
@ -667,14 +679,20 @@ begin
|
|||
var bl := sz*count;
|
||||
var a := new byte[bl];
|
||||
var gc_hnd1 := GCHandle.Alloc(o, GCHandleType.Pinned);
|
||||
var gc_hnd2 := GCHandle.Alloc(a, GCHandleType.Pinned);
|
||||
System.Buffer.MemoryCopy(
|
||||
System.IntPtr.Add(gc_hnd1.AddrOfPinnedObject, from * sz).ToPointer,
|
||||
gc_hnd2.AddrOfPinnedObject.ToPointer,
|
||||
bl,bl
|
||||
);
|
||||
gc_hnd1.Free;
|
||||
gc_hnd2.Free;
|
||||
try
|
||||
var gc_hnd2 := GCHandle.Alloc(a, GCHandleType.Pinned);
|
||||
try
|
||||
System.Buffer.MemoryCopy(
|
||||
System.IntPtr.Add(gc_hnd1.AddrOfPinnedObject, from * sz).ToPointer,
|
||||
gc_hnd2.AddrOfPinnedObject.ToPointer,
|
||||
bl,bl
|
||||
);
|
||||
finally
|
||||
gc_hnd2.Free;
|
||||
end;
|
||||
finally
|
||||
gc_hnd1.Free;
|
||||
end;
|
||||
bw.Write(a);
|
||||
end;
|
||||
|
||||
|
|
@ -692,20 +710,23 @@ begin
|
|||
|
||||
var a := new byte[sz*o.Count];
|
||||
var gc_hnd := GCHandle.Alloc(a, GCHandleType.Pinned);
|
||||
var hnd := gc_hnd.AddrOfPinnedObject;
|
||||
foreach var el in o do
|
||||
if from > 0 then from -= 1 else
|
||||
if count > 0 then
|
||||
begin
|
||||
System.Buffer.MemoryCopy(
|
||||
@el,
|
||||
hnd.ToPointer,
|
||||
sz,sz
|
||||
);
|
||||
hnd := System.IntPtr.Add(hnd, sz);
|
||||
count -= 1;
|
||||
end;
|
||||
gc_hnd.Free;
|
||||
try
|
||||
var hnd := gc_hnd.AddrOfPinnedObject;
|
||||
foreach var el in o do
|
||||
if from > 0 then from -= 1 else
|
||||
if count > 0 then
|
||||
begin
|
||||
System.Buffer.MemoryCopy(
|
||||
@el,
|
||||
hnd.ToPointer,
|
||||
sz,sz
|
||||
);
|
||||
hnd := System.IntPtr.Add(hnd, sz);
|
||||
count -= 1;
|
||||
end;
|
||||
finally
|
||||
gc_hnd.Free;
|
||||
end;
|
||||
bw.Write(a);
|
||||
end;
|
||||
|
||||
|
|
@ -726,12 +747,15 @@ begin
|
|||
|
||||
var a := br.ReadBytes(sz);
|
||||
var gc_hnd := GCHandle.Alloc(a, GCHandleType.Pinned);
|
||||
System.Buffer.MemoryCopy(
|
||||
gc_hnd.AddrOfPinnedObject.ToPointer,
|
||||
@Result,
|
||||
sz,sz
|
||||
);
|
||||
gc_hnd.Free;
|
||||
try
|
||||
System.Buffer.MemoryCopy(
|
||||
gc_hnd.AddrOfPinnedObject.ToPointer,
|
||||
@Result,
|
||||
sz,sz
|
||||
);
|
||||
finally
|
||||
gc_hnd.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function BlockFileOf<T>.Read(count: integer): array of T;
|
||||
|
|
@ -744,14 +768,20 @@ begin
|
|||
var a := br.ReadBytes(bl);
|
||||
Result := new T[count];
|
||||
var gc_hnd1 := GCHandle.Alloc(a, GCHandleType.Pinned);
|
||||
var gc_hnd2 := GCHandle.Alloc(Result, GCHandleType.Pinned);
|
||||
System.Buffer.MemoryCopy(
|
||||
gc_hnd1.AddrOfPinnedObject.ToPointer,
|
||||
gc_hnd2.AddrOfPinnedObject.ToPointer,
|
||||
bl,bl
|
||||
);
|
||||
gc_hnd1.Free;
|
||||
gc_hnd2.Free;
|
||||
try
|
||||
var gc_hnd2 := GCHandle.Alloc(Result, GCHandleType.Pinned);
|
||||
try
|
||||
System.Buffer.MemoryCopy(
|
||||
gc_hnd1.AddrOfPinnedObject.ToPointer,
|
||||
gc_hnd2.AddrOfPinnedObject.ToPointer,
|
||||
bl,bl
|
||||
);
|
||||
finally
|
||||
gc_hnd2.Free;
|
||||
end;
|
||||
finally
|
||||
gc_hnd1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function BlockFileOf<T>.Read(start_elm, count:integer): array of T;
|
||||
|
|
|
|||
|
|
@ -79,12 +79,21 @@ type
|
|||
c: Color := Colors.Black;
|
||||
th: real := 1;
|
||||
fx,fy: real;
|
||||
rc: boolean := false;
|
||||
function PenConstruct: GPen;
|
||||
begin
|
||||
Result := new GPen(new SolidColorBrush(c),th);
|
||||
Result.LineJoin := PenLineJoin.Round;
|
||||
//Result.StartLineCap := PenLineCap.Round;
|
||||
//Result.EndLineCap := PenLineCap.Round;
|
||||
if rc then
|
||||
begin
|
||||
Result.StartLineCap := PenLineCap.Round;
|
||||
Result.EndLineCap := PenLineCap.Round;
|
||||
end
|
||||
else
|
||||
begin
|
||||
Result.StartLineCap := PenLineCap.Flat;
|
||||
Result.EndLineCap := PenLineCap.Flat;
|
||||
end;
|
||||
end;
|
||||
public
|
||||
/// Цвет пера
|
||||
|
|
@ -95,6 +104,8 @@ type
|
|||
property X: real read fx;
|
||||
/// Текущая координата Y пера
|
||||
property Y: real read fy;
|
||||
/// Скругление пера на концах линий
|
||||
property RoundCap: boolean read rc write rc;
|
||||
end;
|
||||
|
||||
// -----------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -875,9 +875,9 @@ type
|
|||
var pp := value;
|
||||
// ширина и высота будут некорректно. Надо переопределить на чтение
|
||||
var x1 := pp.Min(p->p.x);
|
||||
var x2 := pp.Max(p->p.x);
|
||||
//var x2 := pp.Max(p->p.x);
|
||||
var y1 := pp.Min(p->p.y);
|
||||
var y2 := pp.Max(p->p.y);
|
||||
//var y2 := pp.Max(p->p.y);
|
||||
var a := pp.Select(p->Pnt(p.x-x1,p.y-y1)).ToArray;
|
||||
MoveTo(x1,y1);
|
||||
//(gr.Width,gr.Height) := (x2-x1,y2-y1);
|
||||
|
|
@ -979,6 +979,14 @@ function ObjectUnderPoint(x,y: real): ObjectWPF;
|
|||
/// Возвращает True если графические объекты пересекаются
|
||||
function ObjectsIntersect(o1,o2: ObjectWPF): boolean;
|
||||
|
||||
// -----------------------------------------------------
|
||||
//>> Другие подпрограммы# Other functions
|
||||
// -----------------------------------------------------
|
||||
/// Перемещает объект на передний план
|
||||
procedure ToFront(o: ObjectWPF);
|
||||
/// Перемещает объект на задний план
|
||||
procedure ToBack(o: ObjectWPF);
|
||||
|
||||
///--
|
||||
procedure __InitModule__;
|
||||
///--
|
||||
|
|
@ -1214,6 +1222,14 @@ function ObjectsIntersect(o1,o2: ObjectWPF)
|
|||
function IntersectionList(Self: ObjectWPF): List<ObjectWPF>; extensionmethod
|
||||
:= Invoke&<List<ObjectWPF>>(OLHelper.Create(Self).f);
|
||||
|
||||
procedure ToFront(o: ObjectWPF) := Objects.ToFront(o);
|
||||
|
||||
procedure ToBack(o: ObjectWPF) := Objects.ToBack(o);
|
||||
|
||||
procedure ToFront(Self: ObjectWPF); extensionmethod := Objects.ToFront(Self);
|
||||
|
||||
procedure ToBack(Self: ObjectWPF); extensionmethod := Objects.ToBack(Self);
|
||||
|
||||
var
|
||||
///--
|
||||
__initialized := false;
|
||||
|
|
|
|||
7
TestSuite/errors/err0317.pas
Normal file
7
TestSuite/errors/err0317.pas
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
type
|
||||
T = class
|
||||
procedure operator+=(a, b:T) := exit;
|
||||
end;
|
||||
|
||||
begin
|
||||
end.
|
||||
|
|
@ -21,6 +21,7 @@ namespace TreeConverter.LambdaExpressions.Closure
|
|||
private CapturedVariablesTreeNode _rootNode;
|
||||
private CapturedVariablesTreeNodeClassScope _classScope;
|
||||
private CapturedVariablesTreeNodeProcedureScope _procedureScope;
|
||||
private List<CapturedVariablesTreeNode.CapturedSymbolInfo> _pendingCapturedSymbols = new List<CapturedVariablesTreeNode.CapturedSymbolInfo>();
|
||||
|
||||
public class CapturedVariablesInfo
|
||||
{
|
||||
|
|
@ -104,7 +105,9 @@ namespace TreeConverter.LambdaExpressions.Closure
|
|||
_currentTreeNode = newTreeNode;
|
||||
|
||||
_scopesCapturedVarsNodesDictionary.Add(stl.Scope.ScopeNum, _currentTreeNode);
|
||||
|
||||
foreach (var csi in _pendingCapturedSymbols)
|
||||
_currentTreeNode.VariablesDefinedInScope.Add(csi);
|
||||
_pendingCapturedSymbols.Clear();
|
||||
if (stmtList.subnodes != null)
|
||||
{
|
||||
foreach (var stmt in stmtList.subnodes)
|
||||
|
|
@ -130,9 +133,15 @@ namespace TreeConverter.LambdaExpressions.Closure
|
|||
}
|
||||
}
|
||||
|
||||
public override void visit(exception_handler _exception_handler)
|
||||
public override void visit(exception_handler eh)
|
||||
{
|
||||
ProcessNode(_exception_handler.statements);
|
||||
_visitor.context.add_var_definition(eh.variable.name, _visitor.get_location(eh.variable), _visitor.convert_strong(eh.type_name), PascalABCCompiler.SemanticTree.polymorphic_state.ps_common, true);
|
||||
SymbolInfo si = _visitor.context.find_first(eh.variable.name);
|
||||
var csi = new CapturedVariablesTreeNode.CapturedSymbolInfo(eh, si);
|
||||
//_currentTreeNode.VariablesDefinedInScope.Add(new CapturedVariablesTreeNode.CapturedSymbolInfo(eh, si));
|
||||
_pendingCapturedSymbols.Add(csi);
|
||||
ProcessNode(eh.statements);
|
||||
_pendingCapturedSymbols.Remove(csi);
|
||||
}
|
||||
|
||||
public override void visit(ident id)
|
||||
|
|
|
|||
|
|
@ -13357,6 +13357,17 @@ namespace PascalABCCompiler.TreeConverter
|
|||
AddError(get_location(_procedure_header), "EXTENSION_CONSTRUCTOR_NOT_ALLOWED");
|
||||
}
|
||||
|
||||
if (context.top_function.IsOperator)
|
||||
{
|
||||
if (context.top_function is common_method_node)
|
||||
{
|
||||
common_method_node cmmn = context.top_function as common_method_node;
|
||||
if (cmmn.polymorphic_state != SemanticTree.polymorphic_state.ps_static)
|
||||
{
|
||||
AddError(get_location(_procedure_header), "OVERLOADED_OPERATOR_MUST_BE_STATIC_FUNCTION");
|
||||
}
|
||||
}
|
||||
}
|
||||
bool unique = context.close_function_params(body_exists);
|
||||
|
||||
if (context.converted_type != null && context.converted_type.IsInterface)
|
||||
|
|
|
|||
Loading…
Reference in a new issue