View Issue Details

IDProjectCategoryView StatusLast Update
0035398pas2jsrtlpublic2020-02-09 19:09
ReportersilvioprogAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionnot fixable 
Product VersionProduct Build 
Target VersionFixed in Version 
Summary0035398: [PATCH] jsDelete for instance deletion
DescriptionHello.

The attached patch declares a new overloaded jsDelete() function which deletes a instance. For example, this code:

  x := TJSJSON.parse('{"abc":123}');
  jsDelete(x);
  console.log(x); // prints "undefined"


is equivalent to:

  x := TJSJSON.parse('{"abc":123}');
  asm
    delete(x);
  end;
  console.log(x); // prints "undefined"


or:

  x := TJSJSON.parse('{"abc":123}');
  asm
    delete x;
  end;
  console.log(x); // prints "undefined"


cheers
TagsNo tags attached.
Fixed in Revision
Attached Files

Activities

silvioprog

2019-04-16 15:32

reporter  

js.pas.diff.0001 (987 bytes)

Michael Van Canneyt

2020-02-09 19:09

administrator   ~0120976

This will not work. Consider the following, which I tried in Firefox:

>> var aa = {"a":1};
<- undefined
>> delete(aa)
<- false
>> console.log(aa);
<- undefined
Object { a: 1 }

As you can see, delete returns false, and the object is still defined.

This is also consistent with the explanation at:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete

The delete operator can only be used on configurable properties of an object.

Issue History

Date Modified Username Field Change
2019-04-16 15:32 silvioprog New Issue
2019-04-16 15:32 silvioprog File Added: js.pas.diff.0001
2019-04-22 23:26 Michael Van Canneyt Assigned To => Michael Van Canneyt
2019-04-22 23:26 Michael Van Canneyt Status new => assigned
2020-02-09 19:09 Michael Van Canneyt Status assigned => resolved
2020-02-09 19:09 Michael Van Canneyt Resolution open => not fixable
2020-02-09 19:09 Michael Van Canneyt Note Added: 0120976