diff --git a/Objective-J/ObjJAcornCompiler.js b/Objective-J/ObjJAcornCompiler.js index 79646a0e6..0e9d16f98 100644 --- a/Objective-J/ObjJAcornCompiler.js +++ b/Objective-J/ObjJAcornCompiler.js @@ -2381,9 +2381,9 @@ Reference: function(node, st, c) { buffer.concat(" "); // Add an extra space if it looks something like this: "return()". No space between return and expression. } buffer.concat("function(__input) { if (arguments.length) return "); - buffer.concat(node.element.name); + c(node.element, st, "Expression"); buffer.concat(" = __input; return "); - buffer.concat(node.element.name); + c(node.element, st, "Expression"); buffer.concat("; }"); if (!generate) compiler.lastPos = node.end; }, diff --git a/Tests/Objective-J/Preprocessor/OutputTests/Misc/ref-self.j b/Tests/Objective-J/Preprocessor/OutputTests/Misc/ref-self.j new file mode 100644 index 000000000..d94fa2450 --- /dev/null +++ b/Tests/Objective-J/Preprocessor/OutputTests/Misc/ref-self.j @@ -0,0 +1,11 @@ +@implementation TC +{ + id _control; +} + +- (id)a +{ + @ref(_control); +} + +@end diff --git a/Tests/Objective-J/Preprocessor/OutputTests/Misc/ref-self.js b/Tests/Objective-J/Preprocessor/OutputTests/Misc/ref-self.js new file mode 100644 index 000000000..778d931d6 --- /dev/null +++ b/Tests/Objective-J/Preprocessor/OutputTests/Misc/ref-self.js @@ -0,0 +1,9 @@ +{var the_class = objj_allocateClassPair(Nil, "TC"), +meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_control")]);objj_registerClassPair(the_class); +class_addMethods(the_class, [new objj_method(sel_getUid("a"), function $TC__a(self, _cmd) +{ + function(__input) { if (arguments.length) return self._control = __input; return self._control; }; +} + +,["id"])]); +} diff --git a/Tests/Objective-J/Preprocessor/OutputTests/OutputTest.j b/Tests/Objective-J/Preprocessor/OutputTests/OutputTest.j index a94c74f3b..fcd96ba3c 100644 --- a/Tests/Objective-J/Preprocessor/OutputTests/OutputTest.j +++ b/Tests/Objective-J/Preprocessor/OutputTests/OutputTest.j @@ -22,6 +22,7 @@ var FILENAMES = [ "Misc/regex-simple-char-classes", "Misc/empty-loops", "Misc/empty-statements", + "Misc/ref-self", ]; @implementation OutputTest : OJTestCase