BUG修复:PaxScript的Array.cancat会覆盖源数组的最后一个元素

array.concat函数执行后,会覆盖最后一个元素;
 
比如:
var a=new Array();
a[0]=1;
a[1]=2;
 
a.concat([3,4]);
 
结果 a 应该为:[1,2,3,4], 但实际运行的结果是:[1,3,4];
 
源数组的最后一个元素被覆盖了。
 
经检查,发现错误出现在 IMP_JavaScript.pas 的_Array_concat函数。
修改如下:
procedure _Array_concat(M: TPAXMethodBody);
var
  Source, Dest: TPAXJavaScriptArrayObject;
  I, J, K, L: Integer;
  V: Variant;
  PaxArray: TPaxArray;
begin
  with M do
  begin
    Source := TPAXJavaScriptArrayObject(Self);
    L := Source.Length;
    Dest := TPAXJavaScriptArrayObject.Create(Source.ClassRec);
    Dest.Length := L;
    for I:=0 to L - 1 do
      Dest[I] := Source[I];
 
    //ked mod 2009年10月22日  -1会覆盖source的最后一个元素
    //K := Dest.Length - 1;
    K := Dest.Length ;
    //end ked mod 2009年10月22日
 
...
 
 
 
 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
paxscriptnet2.7(价值187美金)C#代码解释执行器 About paxScript.NET 18 December 2013. Support of MS Visual Studio 2013. The Microsoft NET version of the paxScript scripting engine (paxScript.NET) includes interpreters of C# and VB.NET languages. The key features of paxScript.NET are: paxScript.NET is written in C#. Source code of paxScript.NET is CLS compilant. Support of Silverlight and Windows Phone platforms of Microsoft .NET Framework. Support of Mono. paxScript.NET compiles programs into byte-code. It does not use CodeDOM and it does not generate a dynamic assembly. Separate compilation of modules is allowed. You can combine source code modules and compiled (binary) modules in your paxScript.NET script project. Cross-language scripting is allowed. You can combine modules written in C# and VB.NET in your paxScript.NET script project. C# interpreter is based on the ECMA-334 standard. It supports all C# language features with exception for the unsafe code, attributes and generic types. The interpreter extends standard of C# language with extra features which simplify the use of C# for scripting needs (more...). paxScript.NET is implemented as a .NET component ( paxscript-net.dll) which can be used with Microsoft Visual Studio .NET and Mono. The component allows you to embed paxScript.NET interpreter into your WinForms, Mobile or ASP.NET application so you can customize and extend the application without having to recompile it. Any classes, structures, enumerations, arrays, delegates, events and interfaces of host application can be used in a script. (See demo...). You call script-defined methods from host application. (See demo...). Debug capabilities: breakpoints, call stack, watch/evaluate, trace into, step over etc. (See demo...).
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值