This commit is contained in:
Бондарев Иван 2018-03-18 18:50:52 +01:00
parent 547742e09f
commit 2dab23a7f5
3 changed files with 69 additions and 13 deletions

View file

@ -7846,8 +7846,10 @@ namespace PascalABCCompiler.NETGenerator
il.Emit(OpCodes.Call, ti.assign_meth);
return;
}
EmitBox(from, fi.FieldType);
if (ti != null)
EmitBox(from, ti.tp);
else
EmitBox(from, fi.FieldType);
CheckArrayAssign(to, from, il);
il.Emit(OpCodes.Stsfld, fi);
}

View file

@ -767,15 +767,6 @@ type
d();
end;
procedure BeginT;
begin
sb := CreateStoryboard;
InitAnim(sb);
ApplyAllDecorators;
sb.Completed += procedure (o, e) -> sb.Children.Clear;
sb.Begin;
end;
procedure InitAnimWait(sb: StoryBoard; waittime: real); virtual;
begin
end;
@ -870,9 +861,34 @@ type
Result := Self;
end;
private
procedure BeginT;
begin
sb := CreateStoryboard;
InitAnim(sb);
ApplyAllDecorators;
sb.Completed += procedure (o, e) -> sb.Children.Clear;
sb.Begin;
end;
procedure RemoveT := begin
sb.Pause;
sb := new Storyboard;
end;
procedure ChangeT(a: MyAnimation);
begin
sb := CreateStoryboard;
Print(a.sb);
foreach var d in a.sb.Children do
sb.Children.Add(d);
Print(2);
end;
public
procedure &Begin; virtual := Invoke(BeginT);
procedure Pause := sb.Pause;
procedure Resume := sb.Resume;
procedure Remove := Invoke(RemoveT);
procedure Change(a: MyAnimation) := Invoke(ChangeT,a);
procedure Pause := if sb<>nil then sb.Pause;
procedure Resume := if sb<>nil then sb.Resume;
function Duration: real; virtual := seconds;
function &Then(second: MyAnimation): MyAnimation;
function Forever: MyAnimation; virtual := Self;
@ -880,6 +896,16 @@ type
function AccelerationRatio(acceleration: real; deceleration: real := 0): MyAnimation; virtual := Self;
end;
EmptyAnimation = class(MyAnimation)
public
constructor(wait: real);
begin
Self.Seconds := wait;
end;
procedure InitAnim(sb: StoryBoard); virtual := InitAnimWait(sb, Seconds);
end;
Double1AnimationBase = class(MyAnimation)
private
v: real;
@ -1279,6 +1305,8 @@ function operator*(a, b: MyAnimation): MyAnimation; extensionmethod := Animate.G
function MyAnimation.&Then(second: MyAnimation): MyAnimation := Self + second;
function EmptyAnim(sec: real) := EmptyAnimation.Create(sec);
//------------------------------ End Animation -------------------------------

26
TestSuite/generics15.pas Normal file
View file

@ -0,0 +1,26 @@
type
t1<T>=class
class l: byte;
a: byte;
class procedure test;
begin
t1&<T>.l := 3;
assert(t1&<T>.l = 3);
end;
class procedure test(var a: byte);
begin
assert(a = 3);
end;
end;
begin
t1&<byte>.l := 2;
t1&<char>.l := 3;
assert(t1&<byte>.l = 2);
assert(t1&<char>.l = 3);
var o := new t1<byte>;
o.a := 2;
assert(o.a = 2);
t1&<char>.test;
t1&<char>.test(t1&<char>.l);
end.