-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
delete
keyword to delete variables and object items
- Loading branch information
1 parent
04d1b71
commit e06681b
Showing
11 changed files
with
175 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Before deletion: hello | ||
After deletion: null | ||
Before index accessor deletion: value1 | ||
After index accessor deletion: null | ||
Attempt deletion of non-object index accessor: null | ||
Before property accessor deletion: value2 | ||
After property accessor deletion: null | ||
Attempt deletion of non-object property accessor: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
var value = "hello"; | ||
|
||
syscall io_out("Before deletion: "); | ||
syscall io_out(value); | ||
syscall io_out("\n"); | ||
|
||
delete value; | ||
|
||
syscall io_out("After deletion: "); | ||
syscall io_out(value); | ||
syscall io_out("\n"); | ||
|
||
var object = { | ||
"key": "value1", | ||
prop: "value2" | ||
}; | ||
|
||
syscall io_out("Before index accessor deletion: "); | ||
syscall io_out(object["key"]); | ||
syscall io_out("\n"); | ||
|
||
delete object["key"]; | ||
|
||
syscall io_out("After index accessor deletion: "); | ||
syscall io_out(object["key"]); | ||
syscall io_out("\n"); | ||
|
||
syscall io_out("Attempt deletion of non-object index accessor: "); | ||
syscall io_out(value["key"]); | ||
syscall io_out("\n"); | ||
|
||
syscall io_out("Before property accessor deletion: "); | ||
syscall io_out(object.prop); | ||
syscall io_out("\n"); | ||
|
||
delete object.prop; | ||
|
||
syscall io_out("After property accessor deletion: "); | ||
syscall io_out(object.prop); | ||
syscall io_out("\n"); | ||
|
||
syscall io_out("Attempt deletion of non-object property accessor: "); | ||
syscall io_out(value.prop); | ||
syscall io_out("\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters