Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add an Immutable proxy builder. cleanup and streamline the decorator …
…builder
- Loading branch information
1 parent
9844036
commit 7a4244c
Showing
4 changed files
with
41 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
namespace Rosella { namespace Proxy { namespace Builder | ||
{ | ||
class Immutable : Rosella.Proxy.Builder | ||
{ | ||
function setup_proxy_class(var target_class, var proxy_class) | ||
{ | ||
using Rosella.Proxy.Builder.Immutable.intercept_immutable; | ||
proxy_class.add_vtable_override("set_attr_str", intercept_immutable); | ||
proxy_class.add_vtable_override("set_integer_native", intercept_immutable); | ||
proxy_class.add_vtable_override("set_string_native", intercept_immutable); | ||
proxy_class.add_vtable_override("set_number_native", intercept_immutable); | ||
proxy_class.add_vtable_override("set_pmc", intercept_immutable); | ||
proxy_class.add_vtable_override("assign_pmc", intercept_immutable); | ||
} | ||
|
||
function intercept_immutable[nsentry](var args [slurpy]) | ||
{ | ||
die("Cannot modify values of an immutable object"); | ||
} | ||
} | ||
}}} |