Need to re-examine this.

Revert "Make @accessors generating code with static type. Not id only. This is useful when check ivar infomation from class_copyMethodList(YourClass)."

This reverts commit c713a3fb25.
This commit is contained in:
Ross Boucher
2010-12-02 10:06:10 -08:00
parent eb6c103396
commit e71cbfbde2
+2 -6
View File
@@ -456,10 +456,7 @@ Preprocessor.prototype.implementation = function(tokens, /*StringBuffer*/ aStrin
{
token = tokens.next();
if (token === TOKEN_ACCESSORS)
{
attributes = this.accessors(tokens);
attributes["type"] = declaration[0];
}
else if (token !== TOKEN_OUTLET)
throw new SyntaxError(this.error_message("*** Unexpected '@' token in ivar declaration ('@"+token+"')."));
}
@@ -505,12 +502,11 @@ Preprocessor.prototype.implementation = function(tokens, /*StringBuffer*/ aStrin
for (ivar_name in accessors)
{
var accessor = accessors[ivar_name],
ivar_type = accessor["type"] || "id",
property = accessor["property"] || ivar_name;
// getter
var getterName = accessor["getter"] || property,
getterCode = "(" + ivar_type + ")" + getterName + "\n{\nreturn " + ivar_name + ";\n}";
getterCode = "(id)" + getterName + "\n{\nreturn " + ivar_name + ";\n}";
if (IS_NOT_EMPTY(instance_methods))
CONCAT(instance_methods, ",\n");
@@ -529,7 +525,7 @@ Preprocessor.prototype.implementation = function(tokens, /*StringBuffer*/ aStrin
setterName = (start ? "_" : "") + "set" + property.substr(start, 1).toUpperCase() + property.substring(start + 1) + ":";
}
var setterCode = "(void)" + setterName + "(" + ivar_type + ")newValue\n{\n";
var setterCode = "(void)" + setterName + "(id)newValue\n{\n";
if (accessor["copy"])
setterCode += "if (" + ivar_name + " !== newValue)\n" + ivar_name + " = [newValue copy];\n}";