mirror of https://github.com/swig/swig
Replace Language::is_assignable with Language::is_immutable
Avoids confusion with newly created Allocate::is_assignable. Language::is_immutable is just a wrapper around the "feature:immutable" flag since previous commit. is_mutable rename wip
This commit is contained in:
parent
e07957ad4c
commit
c0b36721a3
|
@ -2443,7 +2443,7 @@ private:
|
|||
|
||||
String *mname = Swig_name_member(getNSpace(), Getattr(var_class, "sym:name"), var_name);
|
||||
|
||||
if (is_assignable(var)) {
|
||||
if (!is_immutable(var)) {
|
||||
for (Iterator ki = First(var); ki.key; ki = Next(ki)) {
|
||||
if (Strncmp(ki.key, "tmap:", 5) == 0) {
|
||||
Delattr(var, ki.key);
|
||||
|
|
|
@ -1085,7 +1085,7 @@ public:
|
|||
Replaceall(proc_name, "_", "-");
|
||||
Setattr(n, "wrap:name", proc_name);
|
||||
|
||||
int assignable = is_assignable(n);
|
||||
int assignable = !is_immutable(n);
|
||||
|
||||
if (1 || (SwigType_type(t) != T_USER) || (is_a_pointer(t))) {
|
||||
|
||||
|
|
|
@ -872,7 +872,7 @@ int JSEmitter::enterVariable(Node *n) {
|
|||
SetFlag(state.variable(), IS_STATIC);
|
||||
}
|
||||
|
||||
if (!Language::instance()->is_assignable(n)) {
|
||||
if (Language::instance()->is_immutable(n)) {
|
||||
SetFlag(state.variable(), IS_IMMUTABLE);
|
||||
}
|
||||
// FIXME: test "arrays_global" does not compile with that as it is not allowed to assign to char[]
|
||||
|
|
|
@ -1470,7 +1470,7 @@ int Language::membervariableHandler(Node *n) {
|
|||
|
||||
/* Create a function to set the value of the variable */
|
||||
|
||||
int assignable = is_assignable(n);
|
||||
int assignable = !is_immutable(n);
|
||||
|
||||
if (SmartPointer) {
|
||||
if (!Getattr(CurrentClass, "allocate:smartpointermutable")) {
|
||||
|
@ -2923,7 +2923,7 @@ int Language::variableWrapper(Node *n) {
|
|||
}
|
||||
|
||||
/* If no way to set variables. We simply create functions */
|
||||
int assignable = is_assignable(n);
|
||||
int assignable = !is_immutable(n);
|
||||
int flags = use_naturalvar_mode(n);
|
||||
if (!GetFlag(n, "wrappedasconstant"))
|
||||
flags = flags | Extend;
|
||||
|
@ -3735,8 +3735,8 @@ void Language::setOverloadResolutionTemplates(String *argc, String *argv) {
|
|||
argv_template_string = Copy(argv);
|
||||
}
|
||||
|
||||
int Language::is_assignable(Node *n) {
|
||||
return !GetFlag(n, "feature:immutable");
|
||||
int Language::is_immutable(Node *n) {
|
||||
return GetFlag(n, "feature:immutable");
|
||||
}
|
||||
|
||||
String *Language::runtimeCode() {
|
||||
|
|
|
@ -914,7 +914,7 @@ public:
|
|||
* ------------------------------------------------------------ */
|
||||
|
||||
void registerVariable(Node *n, bool overwrite = false, String *overwriteLuaScope = 0) {
|
||||
int assignable = is_assignable(n);
|
||||
int assignable = !is_immutable(n);
|
||||
String *symname = Getattr(n, "sym:name");
|
||||
assert(symname);
|
||||
|
||||
|
|
|
@ -829,7 +829,7 @@ public:
|
|||
Wrapper_add_local(f, "swig_result", "SWIG_CAMLlocal1(swig_result)");
|
||||
Printf(f->code, "swig_result = Val_unit;\n");
|
||||
|
||||
int assignable = is_assignable(n);
|
||||
int assignable = !is_immutable(n);
|
||||
if (assignable) {
|
||||
/* Check for a setting of the variable value */
|
||||
Printf(f->code, "if (args != Val_int(0)) {\n");
|
||||
|
|
|
@ -836,7 +836,7 @@ public:
|
|||
|
||||
Octave_begin_function(n, setf->def, setname, setwname, true);
|
||||
Printf(setf->code, "if (!SWIG_check_num_args(\"%s_set\",args.length(),1,1,0)) return octave_value_list();\n", iname);
|
||||
if (is_assignable(n)) {
|
||||
if (!is_immutable(n)) {
|
||||
Setattr(n, "wrap:name", setname);
|
||||
if ((tm = Swig_typemap_lookup("varin", n, name, 0))) {
|
||||
Replaceall(tm, "$input", "args(0)");
|
||||
|
|
|
@ -969,7 +969,7 @@ public:
|
|||
|
||||
/* Create a Perl function for setting the variable value */
|
||||
|
||||
int assignable = is_assignable(n);
|
||||
int assignable = !is_immutable(n);
|
||||
if (assignable) {
|
||||
Setattr(n, "wrap:name", set_name);
|
||||
Printf(setf->def, "SWIGCLASS_STATIC int %s(pTHX_ SV* sv, MAGIC * SWIGUNUSEDPARM(mg)) {\n", set_name);
|
||||
|
|
|
@ -3460,7 +3460,7 @@ public:
|
|||
Printf(f_shadow_stubs, "%s = %s.%s\n", global_name, module, global_name);
|
||||
}
|
||||
}
|
||||
int assignable = is_assignable(n);
|
||||
int assignable = !is_immutable(n);
|
||||
|
||||
if (!builtin && shadow && !assignable && !in_class)
|
||||
Printf(f_shadow_stubs, "%s = %s.%s\n", iname, global_name, iname);
|
||||
|
@ -5058,7 +5058,7 @@ public:
|
|||
String *mname = Swig_name_member(NSPACE_TODO, class_name, symname);
|
||||
String *setname = Swig_name_set(NSPACE_TODO, mname);
|
||||
String *getname = Swig_name_get(NSPACE_TODO, mname);
|
||||
int assignable = is_assignable(n);
|
||||
int assignable = !is_immutable(n);
|
||||
String *variable_annotation = variableAnnotation(n);
|
||||
Printv(f_shadow, tab4, symname, variable_annotation, " = property(", module, ".", getname, NIL);
|
||||
if (assignable)
|
||||
|
@ -5113,7 +5113,7 @@ public:
|
|||
add_method(getname, wrapgetname, 0);
|
||||
Wrapper_print(f, f_wrappers);
|
||||
DelWrapper(f);
|
||||
int assignable = is_assignable(n);
|
||||
int assignable = !is_immutable(n);
|
||||
if (assignable) {
|
||||
int funpack = fastunpack;
|
||||
Wrapper *f = NewWrapper();
|
||||
|
|
|
@ -2143,7 +2143,7 @@ public:
|
|||
String *tm;
|
||||
String *getfname, *setfname;
|
||||
Wrapper *getf, *setf;
|
||||
const int assignable = is_assignable(n);
|
||||
int assignable = !is_immutable(n);
|
||||
|
||||
// Determine whether virtual global variables shall be used
|
||||
// which have different getter and setter signatures,
|
||||
|
@ -2757,7 +2757,7 @@ public:
|
|||
Printf(f_wrappers, "%s", docs);
|
||||
Delete(docs);
|
||||
|
||||
if (is_assignable(n)) {
|
||||
if (!is_immutable(n)) {
|
||||
String* docs = docstring(n, AUTODOC_SETTER);
|
||||
Printf(f_wrappers, "%s", docs);
|
||||
Delete(docs);
|
||||
|
@ -2812,7 +2812,7 @@ public:
|
|||
Printf(f_wrappers, "%s", docs);
|
||||
Delete(docs);
|
||||
|
||||
if (is_assignable(n)) {
|
||||
if (!is_immutable(n)) {
|
||||
String* docs = docstring(n, AUTODOC_SETTER);
|
||||
Printf(f_wrappers, "%s", docs);
|
||||
Delete(docs);
|
||||
|
|
|
@ -643,7 +643,7 @@ public:
|
|||
addFunctionToScilab(scilabGetFunctionName, scilabGetSmallFunctionName, getFunctionName);
|
||||
|
||||
/* Manage SET function */
|
||||
if (is_assignable(node)) {
|
||||
if (!is_immutable(node)) {
|
||||
Wrapper *setFunctionWrapper = NewWrapper();
|
||||
String *setFunctionName = Swig_name_set(NSPACE_TODO, variableName);
|
||||
String *scilabSetFunctionName = Swig_name_set(NSPACE_TODO, variableName);
|
||||
|
|
|
@ -217,7 +217,7 @@ public:
|
|||
virtual Hash* symbolScopePseudoSymbolLookup(const_String_or_char_ptr scope);
|
||||
static Node *classLookup(const SwigType *s); /* Class lookup */
|
||||
static Node *enumLookup(SwigType *s); /* Enum lookup */
|
||||
virtual int is_assignable(Node *n); /* Is variable assignable? */
|
||||
virtual int is_immutable(Node *n); /* Is variable assignable? */
|
||||
virtual String *runtimeCode(); /* returns the language specific runtime code */
|
||||
virtual String *defaultExternalRuntimeFilename(); /* the default filename for the external runtime */
|
||||
virtual void replaceSpecialVariables(String *method, String *tm, Parm *parm); /* Language specific special variable substitutions for $typemap() */
|
||||
|
|
|
@ -590,7 +590,7 @@ public:
|
|||
DelWrapper(getf);
|
||||
|
||||
/* Try to create a function setting a variable */
|
||||
if (is_assignable(n)) {
|
||||
if (!is_immutable(n)) {
|
||||
setf = NewWrapper();
|
||||
setname = Swig_name_set(NSPACE_TODO, iname);
|
||||
setfname = Swig_name_wrapper(setname);
|
||||
|
|
Loading…
Reference in New Issue