From d38125db13359d14320c196ea64c9b241f5ad7a4 Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Fri, 9 Aug 2013 19:02:45 +0200 Subject: [PATCH 01/25] New: Added Objective-J protocol support The Objective-J parser and compiler now handles protocol syntax. The Objective-J runtime has new functions to handle protocols. The method 'conformsToProtocol:' has been added to CPObject as an instance and a class method. --- Foundation/CPObject.j | 20 + Objective-J/ObjJAcornCompiler.js | 660 ++++++++++++++++-- Objective-J/Runtime.js | 151 +++- Objective-J/acorn.js | 276 ++++++-- Objective-J/acornwalk.js | 16 +- .../Preprocessor/BehaviorTests/ProtocolTest.j | 72 ++ 6 files changed, 1041 insertions(+), 154 deletions(-) create mode 100644 Tests/Objective-J/Preprocessor/BehaviorTests/ProtocolTest.j diff --git a/Foundation/CPObject.j b/Foundation/CPObject.j index bc84e9ce8..72b877c9f 100644 --- a/Foundation/CPObject.j +++ b/Foundation/CPObject.j @@ -254,6 +254,26 @@ CPLog(@"Got some class: %@", inst); return NO; } +/*! + Test whether instances of this class conforms to the provided protocol. + @param aProtocol the protocol for which to test the class + @return \c YES if instances of the class conforms to the protocol +*/ ++ (BOOL)conformsToProtocol:(Protocol)aProtocol +{ + return class_conformsToProtocol(self, aProtocol); +} + +/*! + Tests whether the receiver conforms to the provided protocol. + @param protocol the protocol for which to test the class + @return \c YES if instances of the class conforms to the protocol +*/ +- (BOOL)conformsToProtocol:(Protocol)aProtocol +{ + return class_conformsToProtocol(isa, aProtocol); +} + // Obtaining method information /*! diff --git a/Objective-J/ObjJAcornCompiler.js b/Objective-J/ObjJAcornCompiler.js index 9bdad14a3..3023ac2be 100644 --- a/Objective-J/ObjJAcornCompiler.js +++ b/Objective-J/ObjJAcornCompiler.js @@ -45,7 +45,12 @@ Scope.prototype.isRootScope = function() Scope.prototype.currentClassName = function() { - return this.classDef ? this.classDef.className : this.prev ? this.prev.currentClassName() : null; + return this.classDef ? this.classDef.name : this.prev ? this.prev.currentClassName() : null; +} + +Scope.prototype.currentProtocolName = function() +{ + return this.protocolDef ? this.protocolDef.name : this.prev ? this.prev.currentProtocolName() : null; } Scope.prototype.getIvarForCurrentClass = function(/* String */ ivarName) @@ -144,6 +149,215 @@ StringBuffer.prototype.isEmpty = function() return this.atoms.length !== 0; } +// Both the ClassDef and ProtocolDef conforms to a 'protocol' (That we can't declare in Javascript). +// Both Objects have the attribute 'protocols': Array of ProtocolDef that they conform to +// Both also have the functions: addInstanceMethod, addClassMethod, getInstanceMethod and getClassMethod +// classDef = {"className": aClassName, "superClass": superClass , "ivars": myIvars, "instanceMethods": instanceMethodDefs, "classMethods": classMethodDefs, "protocols": myProtocols}; +var ClassDef = function(isImplementationDeclaration, name, superClass, ivars, instanceMethods, classMethods, protocols) +{ + this.name = name; + if (superClass) + this.superClass = superClass; + if (ivars) + this.ivars = ivars; + if (isImplementationDeclaration) { + this.instanceMethods = instanceMethods || Object.create(null); + this.classMethods = classMethods || Object.create(null); + } + if (protocols) + this.protocols = protocols; +} + +ClassDef.prototype.addInstanceMethod = function(methodDef) { + this.instanceMethods[methodDef.name] = methodDef; +} + +ClassDef.prototype.addClassMethod = function(methodDef) { + this.classMethods[methodDef.name] = methodDef; +} + +ClassDef.prototype.listOfNotImplementedMethodsForProtocols = function(protocolDefs) { + var resultList = [], + instanceMethods = this.getInstanceMethods(), + classMethods = this.getClassMethods(); + + for (var i = 0, size = protocolDefs.length; i < size; i++) + { + var protocolDef = protocolDefs[i], + protocolInstanceMethods = protocolDef.requiredInstanceMethods, + protocolClassMethods = protocolDef.requiredClassMethods, + inheritFromProtocols = protocolDef.protocols; + + if (protocolInstanceMethods) for (var methodName in protocolInstanceMethods) { + var methodDef = protocolInstanceMethods[methodName]; + + if (!instanceMethods[methodName]) + resultList.push({"methodDef": methodDef, "protocolDef": protocolDef}); + } + + if (protocolClassMethods) for (var methodName in protocolClassMethods) { + var methodDef = protocolClassMethods[methodName]; + + if (!classMethods[methodName]) + resultList.push({"methodDef": methodDef, "protocolDef": protocolDef}); + } + + if (inheritFromProtocols) + resultList = resultList.concat(this.listOfNotImplementedMethodsForProtocols(inheritFromProtocols)); + } + + return resultList; +} + +ClassDef.prototype.getInstanceMethod = function(name) { + var instanceMethods = this.instanceMethods; + + if (instanceMethods) { + var method = instanceMethods[name]; + + if (method) + return method; + } + + var superClass = this.superClass; + + if (superClass) + return superClass.getInstanceMethod(name); + + return null; +} + +ClassDef.prototype.getClassMethod = function(name) { + var classMethods = this.classMethods; + if (classMethods) { + var method = classMethods[name]; + + if (method) + return method; + } + + var superClass = this.superClass; + + if (superClass) + return superClass.getClassMethod(name); + + return null; +} + +// Return a new Array with all instance methods +ClassDef.prototype.getInstanceMethods = function() { + var instanceMethods = this.instanceMethods; + if (instanceMethods) { + var superClass = this.superClass, + returnObject = Object.create(null); + if (superClass) { + var superClassMethods = superClass.getInstanceMethods(); + for (var methodName in superClassMethods) + returnObject[methodName] = superClassMethods[methodName]; + } + + for (var methodName in instanceMethods) + returnObject[methodName] = instanceMethods[methodName]; + + return returnObject; + } + + return []; +} + +// Return a new Array with all class methods +ClassDef.prototype.getClassMethods = function() { + var classMethods = this.classMethods; + if (classMethods) { + var superClass = this.superClass, + returnObject = Object.create(null); + if (superClass) { + var superClassMethods = superClass.getClassMethods(); + for (var methodName in superClassMethods) + returnObject[methodName] = superClassMethods[methodName]; + } + + for (var methodName in classMethods) + returnObject[methodName] = classMethods[methodName]; + + return returnObject; + } + + return []; +} + +// protocolDef = {"name": aProtocolName, "protocols": inheritFromProtocols, "requiredInstanceMethods": requiredInstanceMethodDefs, "requiredClassMethods": requiredClassMethodDefs}; +var ProtocolDef = function(name, protocols, requiredInstanceMethodDefs, requiredClassMethodDefs) +{ + this.name = name; + this.protocols = protocols; + if (requiredInstanceMethodDefs) + this.requiredInstanceMethods = requiredInstanceMethodDefs; + if (requiredClassMethodDefs) + this.requiredClassMethods = requiredClassMethodDefs; +} + +ProtocolDef.prototype.addInstanceMethod = function(methodDef) { + (this.requiredInstanceMethods || (this.requiredInstanceMethods = Object.create(null)))[methodDef.name] = methodDef; +} + +ProtocolDef.prototype.addClassMethod = function(methodDef) { + (this.requiredClassMethods || (this.requiredClassMethods = Object.create(null)))[methodDef.name] = methodDef; +} + +ProtocolDef.prototype.getInstanceMethod = function(name) { + var instanceMethods = this.requiredInstanceMethods; + + if (instanceMethods) { + var method = instanceMethods[name]; + + if (method) + return method; + } + + var protocols = this.protocols; + + for (var i = 0, size = protocols.length; i < size; i++) { + var protocol = protocols[i], + method = protocol.getInstanceMethod(name); + + if (method) + return method; + } + + return null; +} + +ProtocolDef.prototype.getClassMethod = function(name) { + var classMethods = this.requiredClassMethods; + + if (classMethods) { + var method = classMethods[name]; + + if (method) + return method; + } + + var protocols = this.protocols; + + for (var i = 0, size = protocols.length; i < size; i++) { + var protocol = protocols[i], + method = protocol.getInstanceMethod(name); + + if (method) + return method; + } + + return null; +} + +// methodDef = {"types": types, "name": selector} +var MethodDef = function(name, types) +{ + this.name = name; + this.types = types; +} + var currentCompilerFlags = ""; var reservedIdentifiers = exports.acorn.makePredicate("self _cmd undefined localStorage arguments"); @@ -153,7 +367,7 @@ var wordPrefixOperators = exports.acorn.makePredicate("delete in instanceof new var isLogicalBinary = exports.acorn.makePredicate("LogicalExpression BinaryExpression"); var isInInstanceof = exports.acorn.makePredicate("in instanceof"); -var ObjJAcornCompiler = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned*/ flags, /*unsigned*/ pass, /* Dictionary */ classDefs) +var ObjJAcornCompiler = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned*/ flags, /*unsigned*/ pass, /* Dictionary */ classDefs, /* Dictionary */ protocolDefs) { this.source = aString; this.URL = new CFURL(aURL); @@ -182,6 +396,7 @@ var ObjJAcornCompiler = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned* this.dependencies = []; this.flags = flags | ObjJAcornCompiler.Flags.IncludeDebugSymbols; this.classDefs = classDefs ? classDefs : Object.create(null); + this.protocolDefs = protocolDefs ? protocolDefs : Object.create(null); this.lastPos = 0; if (currentCompilerFlags & ObjJAcornCompiler.Flags.Generate) this.generate = true; @@ -215,8 +430,8 @@ ObjJAcornCompiler.prototype.compilePass2 = function() this.pass = 2; this.jsBuffer = new StringBuffer(); this.warnings = []; + //print(this.URL + ": Compiling"); compile(this.tokens, new Scope(null ,{ compiler: this }), pass2); - for (var i = 0; i < this.warnings.length; i++) { var message = this.prettifyMessage(this.warnings[i], "WARNING"); @@ -227,6 +442,7 @@ ObjJAcornCompiler.prototype.compilePass2 = function() #endif } + //print(this.URL + ": " + this.jsBuffer.toString()); return this.jsBuffer.toString(); } @@ -271,7 +487,7 @@ ObjJAcornCompiler.prototype.getIvarForClass = function(/* String */ ivarName, /* if (ivarDef) return ivarDef; } - c = this.getClassDef(c.superClassName); + c = c.superClass; } } @@ -279,37 +495,100 @@ ObjJAcornCompiler.prototype.getClassDef = function(/* String */ aClassName) { if (!aClassName) return null; - var c = this.classDefs[aClassName]; + var c = this.classDefs[aClassName]; - if (c) return c; + if (c) return c; - if (objj_getClass) - { - var aClass = objj_getClass(aClassName); - if (aClass) - { - var ivars = class_copyIvarList(aClass), - ivarSize = ivars.length, - myIvars = Object.create(null), - superClass = aClass.super_class; + if (objj_getClass) + { + var aClass = objj_getClass(aClassName); + if (aClass) + { + var ivars = class_copyIvarList(aClass), + ivarSize = ivars.length, + myIvars = Object.create(null), + protocols = class_copyProtocolList(aClass), + protocolSize = protocols.length, + myProtocols = Object.create(null), + instanceMethodDefs = ObjJAcornCompiler.methodDefsFromMethodList(class_copyMethodList(aClass)), + classMethodDefs = ObjJAcornCompiler.methodDefsFromMethodList(class_copyMethodList(aClass.isa)), + superClass = class_getSuperclass(aClass); - for (var i = 0; i < ivarSize; i++) - { - var ivar = ivars[i]; + for (var i = 0; i < ivarSize; i++) + { + var ivar = ivars[i]; - myIvars[ivar.name] = {"type": ivar.type, "name": ivar.name}; - } - c = {"className": aClassName, "ivars": myIvars}; + myIvars[ivar.name] = {"type": ivar.type, "name": ivar.name}; + } - if (superClass) - c.superClassName = superClass.name; - this.classDefs[aClassName] = c; - return c; - } - } + for (var i = 0; i < protocolSize; i++) + { + var protocol = protocols[i], + protocolName = protocol_getName(protocol), + protocolDef = this.getProtocolDef(protocolName); - return null; -// classDef = {"className": className, "superClassName": superClassName, "ivars": Object.create(null), "methods": Object.create(null)}; + myProtocols[protocolName] = protocolDef; + } + + c = new ClassDef(true, aClassName, superClass ? this.getClassDef(superClass.name) : null, myIvars, instanceMethodDefs, classMethodDefs, myProtocols); + this.classDefs[aClassName] = c; + return c; + } + } + + return null; +} + +ObjJAcornCompiler.prototype.getProtocolDef = function(/* String */ aProtocolName) +{ + if (!aProtocolName) return null; + + var p = this.protocolDefs[aProtocolName]; + + if (p) return p; + + if (objj_getProtocol) + { + var aProtocol = objj_getProtocol(aProtocolName); + if (aProtocol) + { + var protocol = protocols[i], + protocolName = protocol_getName(protocol), + requiredInstanceMethods = protocol_copyMethodDescriptionList(protocol, true, true), + requiredInstanceMethodDefs = ObjJAcornCompiler.methodDefsFromMethodList(requiredInstanceMethods), + requiredClassMethods = protocol_copyMethodDescriptionList(protocol, true, false), + requiredClassMethodDefs = ObjJAcornCompiler.methodDefsFromMethodList(requiredClassMethods), + protocols = protocol.protocols, + inheritFromProtocols = []; + + for (var i = 0, size = protocols.length; i < size; i++) + inheritFromProtocols.push(compiler.getProtocolDef(protocols[i].name)); + + p = new ProtocolDef(protocolName, inheritFromProtocols, requiredInstanceMethodDefs, requiredClassMethodDefs); + + this.protocolDefs[aProtocolName] = p; + return c; + } + } + + return null; +// protocolDef = {"name": protocolName, "protocols": Object.create(null), "required": Object.create(null), "optional": Object.create(null)}; +} + +ObjJAcornCompiler.methodDefsFromMethodList = function(/* Array */ methodList) +{ + var methodSize = methodList.length, + myMethods = Object.create(null); + + for (var i = 0; i < methodSize; i++) + { + var method = methodList[i], + methodName = method_getName(method); + + myMethods[methodName] = new MethodDef(methodName, method.types); + } + + return myMethods; } ObjJAcornCompiler.prototype.executable = function() @@ -372,7 +651,9 @@ function createMessage(/* String */ aMessage, /* SpiderMonkey AST node */ node, function compile(node, state, visitor) { function c(node, st, override) { + //print("c: " + (override ? override + ", " : "") + node.type + ", " + exports.acorn.getLineInfo(st.compiler.source, node.start).line); visitor[override || node.type](node, st, c); + //print("cc: " + (override ? override + ", " : "") + node.type + ", " + exports.acorn.getLineInfo(st.compiler.source, node.end).line); } c(node, state); }; @@ -1300,10 +1581,12 @@ ImportStatement: function(node, st, c) { ClassDeclarationStatement: function(node, st, c) { var compiler = st.compiler, generate = compiler.generate, - classDef, saveJSBuffer = compiler.jsBuffer, className = node.classname.name, - classScope = new Scope(st); + classDef = compiler.getClassDef(className), + classScope = new Scope(st), + isInterfaceDeclaration = node.type === "InterfaceDeclarationStatement", + protocols = node.protocols; compiler.imBuffer = new StringBuffer(); compiler.cmBuffer = new StringBuffer(); @@ -1314,10 +1597,19 @@ ClassDeclarationStatement: function(node, st, c) { // First we declare the class if (node.superclassname) { - classDef = compiler.getClassDef(className); - if (classDef && classDef.ivars) // Must have ivars dictionary to be a real declaration. Without it is a "@class" declaration + // Must have methods dictionaries and ivars dictionary to be a real implementaion declaration. + // Without it is a "@class" declaration (without both ivars dictionary and method dictionaries) or + // "interface" declaration (without ivars dictionary) + // TODO: Create a ClassDef object and add this logic to it + if (classDef && classDef.ivars) + // It has a real implementation declaration already throw compiler.error_message("Duplicate class " + className, node.classname); - if (!compiler.getClassDef(node.superclassname.name)) + + if (isInterfaceDeclaration && classDef && classDef.instanceMethods && classDef.classMethods) + // It has a interface declaration already + throw compiler.error_message("Duplicate interface definition for class " + className, node.classname); + var superClassDef = compiler.getClassDef(node.superclassname.name); + if (!superClassDef) { var errorMessage = "Can't find superclass " + node.superclassname.name; for (var i = ObjJAcornCompiler.importStack.length; --i >= 0;) @@ -1325,7 +1617,7 @@ ClassDeclarationStatement: function(node, st, c) { throw compiler.error_message(errorMessage, node.superclassname); } - classDef = {"className": className, "superClassName": node.superclassname.name, "ivars": Object.create(null), "methods": Object.create(null)}; + classDef = new ClassDef(!isInterfaceDeclaration, className, superClassDef, Object.create(null)); saveJSBuffer.concat("{var the_class = objj_allocateClassPair(" + node.superclassname.name + ", \"" + className + "\"),\nmeta_class = the_class.isa;"); } @@ -1341,11 +1633,21 @@ ClassDeclarationStatement: function(node, st, c) { } else { - classDef = {"className": className, "superClassName": null, "ivars": Object.create(null), "methods": Object.create(null)}; + classDef = new ClassDef(!isInterfaceDeclaration, className, null, Object.create(null)); saveJSBuffer.concat("{var the_class = objj_allocateClassPair(Nil, \"" + className + "\"),\nmeta_class = the_class.isa;"); } + if (protocols) for (var i = 0, size = protocols.length; i < size; i++) + { + saveJSBuffer.concat("\nvar aProtocol = objj_getProtocol(\"" + protocols[i].name + "\");"); + saveJSBuffer.concat("\nif (!aProtocol) throw new SyntaxError(\"*** Could not find definition for protocol \\\"" + protocols[i].name + "\\\"\");"); + saveJSBuffer.concat("\nclass_addProtocol(the_class, aProtocol);"); + } +/* + if (isInterfaceDeclaration) + classDef.interfaceDeclaration = true; +*/ classScope.classDef = classDef; compiler.currentSuperClass = "objj_getClass(\"" + className + "\").super_class"; compiler.currentSuperMetaClass = "objj_getMetaClass(\"" + className + "\").super_class"; @@ -1359,8 +1661,12 @@ ClassDeclarationStatement: function(node, st, c) { var ivarDecl = node.ivardeclarations[i], ivarType = ivarDecl.ivartype ? ivarDecl.ivartype.name : null, ivarName = ivarDecl.id.name, + ivars = classDef.ivars, ivar = {"type": ivarType, "name": ivarName}; + if (ivars[ivarName]) + throw compiler.error_message("Instance variable '" + ivarName + "'is already declared for class " + className, ivarDecl.id); + if (firstIvarDeclaration) { firstIvarDeclaration = false; @@ -1376,7 +1682,7 @@ ClassDeclarationStatement: function(node, st, c) { if (ivarDecl.outlet) ivar.outlet = true; - classDef.ivars[ivarName] = ivar; + ivars[ivarName] = ivar; if (!classScope.ivars) classScope.ivars = Object.create(null); classScope.ivars[ivarName] = {type: "ivar", name: ivarName, node: ivarDecl.id, ivar: ivar}; @@ -1389,7 +1695,7 @@ ClassDeclarationStatement: function(node, st, c) { saveJSBuffer.concat("]);"); // If we have accessors add get and set methods for them - if (hasAccessors) + if (!isInterfaceDeclaration && hasAccessors) { var getterSetterBuffer = new StringBuffer(); @@ -1449,20 +1755,22 @@ ClassDeclarationStatement: function(node, st, c) { // We will store the classDef first after accessors are done so we don't get a duplicate class error compiler.classDefs[className] = classDef; - if (node.body.length > 0) + var bodies = node.body, + bodyLength = bodies.length; + + if (bodyLength > 0) { - if (!generate) compiler.lastPos = node.body[0].start; + if (!generate) compiler.lastPos = bodies[0].start; // And last add methods and other statements - for (var i = 0; i < node.body.length; ++i) { - var body = node.body[i]; + for (var i = 0; i < bodyLength; ++i) { + var body = bodies[i]; c(body, classScope, "Statement"); } if (!generate) saveJSBuffer.concat(compiler.source.substring(compiler.lastPos, body.end)); } - // We must make a new class object for our class definition if it's not a category - if (!node.categoryname) { + if (!isInterfaceDeclaration && !node.categoryname) { saveJSBuffer.concat("objj_registerClassPair(the_class);\n"); } @@ -1488,23 +1796,146 @@ ClassDeclarationStatement: function(node, st, c) { // Skip the "@end" if (!generate) compiler.lastPos = node.end; + + // If the class conforms to protocols check that all required methods are implemented + if (protocols) + { + // Lookup the protocolDefs for the protocols + var protocolDefs = []; + + for (var i = 0, size = protocols.length; i < size; i++) + protocolDefs.push(compiler.getProtocolDef(protocols[i].name)); + + var unimplementedMethods = classDef.listOfNotImplementedMethodsForProtocols(protocolDefs); + + if (unimplementedMethods && unimplementedMethods.length > 0) + for (var i = 0, size = unimplementedMethods.length; i < size; i++) { + var unimplementedMethod = unimplementedMethods[i], + methodDef = unimplementedMethod.methodDef, + protocolDef = unimplementedMethod.protocolDef; + + compiler.addWarning(createMessage("Method '" + methodDef.name + "' in protocol '" + protocolDef.name + "' is not implemented", node.classname, compiler.source)); + } + } +}, +ProtocolDeclarationStatement: function(node, st, c) { + var compiler = st.compiler, + generate = compiler.generate, + buffer = compiler.jsBuffer, + protocolName = node.protocolname.name, + protocolDef = compiler.getProtocolDef(protocolName), + protocols = node.protocols, + protocolScope = new Scope(st), + inheritFromProtocols = []; + + if (protocolDef) + throw compiler.error_message("Duplicate protocol " + protocolName, node.protocolName); + + compiler.imBuffer = new StringBuffer(); + compiler.cmBuffer = new StringBuffer(); + + if (!generate) buffer.concat(compiler.source.substring(compiler.lastPos, node.start)); + + buffer.concat("{var the_protocol = objc_allocateProtocol(\"" + protocolName + "\");"); + + if (protocols) for (var i = 0, size = protocols.length; i < size; i++) + { + var protocol = protocols[i], + inheritFromProtocolName = protocol.name; + inheritProtocolDef = compiler.getProtocolDef(inheritFromProtocolName); + + if (!inheritProtocolDef) + throw compiler.error_message("Can't find protocol " + inheritFromProtocolName, protocol); + + buffer.concat("\nvar aProtocol = objj_getProtocol(\"" + inheritFromProtocolName + "\");"); + buffer.concat("\nif (!aProtocol) throw new SyntaxError(\"*** Could not find definition for protocol \\\"" + protocolName + "\\\"\");"); + buffer.concat("\nprotocol_addProtocol(the_protocol, aProtocol);"); + inheritFromProtocols.push(inheritProtocolDef); + } + + protocolDef = new ProtocolDef(protocolName, inheritFromProtocols); + compiler.protocolDefs[protocolName] = protocolDef; + protocolScope.protocolDef = protocolDef; + + var someRequired = node.required, + requiredLength = someRequired.length; + + if (requiredLength > 0) + { + // We only add the required methods + for (var i = 0; i < requiredLength; ++i) { + var required = someRequired[i]; + if (!generate) compiler.lastPos = required.start; + c(required, protocolScope, "Statement"); + } + if (!generate) buffer.concat(compiler.source.substring(compiler.lastPos, required.end)); + } + + buffer.concat("\nobjc_registerProtocol(the_protocol);\n"); + + // Add instance methods + if (compiler.imBuffer.isEmpty()) + { + buffer.concat("protocol_addMethodDescriptions(the_protocol, ["); + buffer.atoms.push.apply(buffer.atoms, compiler.imBuffer.atoms); // FIXME: Move this append to StringBuffer + buffer.concat("], true, false);\n"); + } + + // Add class methods + if (compiler.cmBuffer.isEmpty()) + { + buffer.concat("protocol_addMethodDescriptions(the_protocol, ["); + buffer.atoms.push.apply(buffer.atoms, compiler.cmBuffer.atoms); // FIXME: Move this append to StringBuffer + buffer.concat("], true, true);\n"); + } + + buffer.concat("}"); + + compiler.jsBuffer = buffer; + + // Skip the "@end" + if (!generate) compiler.lastPos = node.end; }, MethodDeclarationStatement: function(node, st, c) { var compiler = st.compiler, generate = compiler.generate, saveJSBuffer = compiler.jsBuffer, methodScope = new Scope(st), + isInstanceMethodType = node.methodtype === '-'; selectors = node.selectors, arguments = node.arguments, - types = [node.returntype ? node.returntype.name : "id"], + returnType = node.returntype, + types = [returnType ? returnType.name : "id"], + returnTypeProtocols = returnType ? returnType.protocols : null; selector = selectors[0].name; // There is always at least one selector + if (returnTypeProtocols) for (var i = 0, size = returnTypeProtocols.length; i < size; i++) { + var returnTypeProtocol = returnTypeProtocols[i]; + if (!compiler.getProtocolDef(returnTypeProtocol.name)) { + compiler.addWarning(createMessage("Cannot find protocol declaration for '" + returnTypeProtocol.name + "'", returnTypeProtocol, compiler.source)); + } + } + if (!generate) saveJSBuffer.concat(compiler.source.substring(compiler.lastPos, node.start)); - compiler.jsBuffer = node.methodtype === '-' ? compiler.imBuffer : compiler.cmBuffer; + compiler.jsBuffer = isInstanceMethodType ? compiler.imBuffer : compiler.cmBuffer; // Put together the selector. Maybe this should be done in the parser... for (var i = 0; i < arguments.length; i++) { + var argument = arguments[i], + argumentType = argument.type, + argumentTypeName = argumentType ? argumentType.name : "id", + argumentProtocols = argumentType ? argumentType.protocols : null; + + types.push(argumentType ? argumentType.name : "id"); + + if (argumentProtocols) for (var i = 0, size = argumentProtocols.length; i < size; i++) { + var argumentProtocol = argumentProtocols[i]; + if (!compiler.getProtocolDef(argumentProtocol.name)) { + compiler.addWarning(createMessage("Cannot find protocol declaration for '" + argumentProtocol.name + "'", argumentProtocol, compiler.source)); + } + } + if (i === 0) selector += ":"; else @@ -1513,45 +1944,111 @@ MethodDeclarationStatement: function(node, st, c) { if (compiler.jsBuffer.isEmpty()) // Add comma separator if this is not first method in this buffer compiler.jsBuffer.concat(", "); + compiler.jsBuffer.concat("new objj_method(sel_getUid(\""); compiler.jsBuffer.concat(selector); - compiler.jsBuffer.concat("\"), function"); + compiler.jsBuffer.concat("\"), "); -// this.currentSelector = selector; + if (node.body) { + compiler.jsBuffer.concat("function"); - if (compiler.flags & ObjJAcornCompiler.Flags.IncludeDebugSymbols) - { - compiler.jsBuffer.concat(" $" + st.currentClassName() + "__" + selector.replace(/:/g, "_")); + if (compiler.flags & ObjJAcornCompiler.Flags.IncludeDebugSymbols) + { + compiler.jsBuffer.concat(" $" + st.currentClassName() + "__" + selector.replace(/:/g, "_")); + } + + compiler.jsBuffer.concat("(self, _cmd"); + + methodScope.methodType = node.methodtype; + if (arguments) for (var i = 0; i < arguments.length; i++) + { + var argument = arguments[i], + argumentName = argument.identifier.name; + + compiler.jsBuffer.concat(", "); + compiler.jsBuffer.concat(argumentName); + methodScope.vars[argumentName] = {type: "method argument", node: argument}; + } + + compiler.jsBuffer.concat(")\n"); + + if (!generate) compiler.lastPos = node.startOfBody; + indentation += indentStep; + c(node.body, methodScope, "Statement"); + indentation = indentation.substring(indentationSpaces); + if (!generate) compiler.jsBuffer.concat(compiler.source.substring(compiler.lastPos, node.body.end)); + + compiler.jsBuffer.concat("\n"); + } else { // It is a interface or protocol declatartion and we don't have a method implementation + compiler.jsBuffer.concat("Nil\n"); } - compiler.jsBuffer.concat("(self, _cmd"); - - methodScope.methodType = node.methodtype; - if (arguments) for (var i = 0; i < arguments.length; i++) - { - var argument = arguments[i], - argumentName = argument.identifier.name; - - compiler.jsBuffer.concat(", "); - compiler.jsBuffer.concat(argumentName); - types.push(argument.type ? argument.type.name : null); - methodScope.vars[argumentName] = {type: "method argument", node: argument}; - } - - compiler.jsBuffer.concat(")\n"); - - if (!generate) compiler.lastPos = node.startOfBody; - indentation += indentStep; - c(node.body, methodScope, "Statement"); - indentation = indentation.substring(indentationSpaces); - if (!generate) compiler.jsBuffer.concat(compiler.source.substring(compiler.lastPos, node.body.end)); - - compiler.jsBuffer.concat("\n"); if (compiler.flags & ObjJAcornCompiler.Flags.IncludeDebugSymbols) compiler.jsBuffer.concat(","+JSON.stringify(types)); + compiler.jsBuffer.concat(")"); compiler.jsBuffer = saveJSBuffer; + if (!generate) compiler.lastPos = node.end; + + // Add the method to the class or protocol definition + var def = st.classDef, + alreadyDeclared; + + // But first, if it is a class definition check if it is declared in superclass or interface declaration + if (def) + alreadyDeclared = isInstanceMethodType ? def.getInstanceMethod(selector) : def.getClassMethod(selector); + else + def = st.protocolDef; + + if (!def) + throw "InternalError: MethodDeclaration without ClassDeclaration or ProtocolDeclaration at line: " + exports.acorn.getLineInfo(compiler.source, node.start).line; + + // Create warnings if types does not corresponds to method declaration in superclass or interface declarations + // If we don't find the method in superclass or interface declarations above or if it is a protocol + // declaration, try to find it in any of the conforming protocols + if (!alreadyDeclared) { + var protocols = def.protocols; + + if (protocols) for (var i = 0, size = protocols.length; i < size; i++) { + var protocol = protocols[i], + alreadyDeclared = isInstanceMethodType ? protocol.getInstanceMethod(selector) : protocol.getClassMethod(selector); + + if (alreadyDeclared) + break; + } + } + + if (alreadyDeclared) { + var declaredTypes = alreadyDeclared.types; + + if (declaredTypes) { + var typeSize = declaredTypes.length; + if (typeSize > 0) { + // First type is return type + var returnType = declaredTypes[0]; + + if (returnType !== types[0]) + compiler.addWarning(createMessage("Conflicting return type in implementation of '" + selector + "': '" + returnType + "' vs '" + types[0] + "'", node.returntype || node, compiler.source)); + + // Check the parameter types. The size of the two type arrays should be the same + for (var i = 1; i < typeSize; i++) { + var parameterType = declaredTypes[i]; + + if (parameterType !== types[i]) + compiler.addWarning(createMessage("Conflicting parameter types in implementation of '" + selector + "': '" + parameterType + "' vs '" + types[i] + "'", node.arguments[i - 1].type || node.arguments[i - 1].identifier, compiler.source)); + } + } + } + } + + // Now we add it + var methodDef = new MethodDef(selector, types); + + if (isInstanceMethodType) + def.addInstanceMethod(methodDef); + else + def.addClassMethod(methodDef); }, MessageSendExpression: function(node, st, c) { var compiler = st.compiler, @@ -1636,6 +2133,19 @@ SelectorLiteralExpression: function(node, st, c) { buffer.concat("\")"); if (!generate) compiler.lastPos = node.end; }, +ProtocolLiteralExpression: function(node, st, c) { + var compiler = st.compiler, + buffer = compiler.jsBuffer, + generate = compiler.generate; + if (!generate) { + buffer.concat(compiler.source.substring(compiler.lastPos, node.start)); + buffer.concat(" "); // Add an extra space if it looks something like this: "return(@protocol(a))". No space between return and expression. + } + buffer.concat("objj_getProtocol(\""); + buffer.concat(node.id.name); + buffer.concat("\")"); + if (!generate) compiler.lastPos = node.end; +}, Reference: function(node, st, c) { var compiler = st.compiler, buffer = compiler.jsBuffer, @@ -1677,7 +2187,7 @@ ClassStatement: function(node, st, c) { } var className = node.id.name; if (!compiler.getClassDef(className)) { - classDef = {"className": className}; + classDef = new ClassDef(false, className); compiler.classDefs[className] = classDef; } st.vars[node.id.name] = {type: "class", node: node.id}; diff --git a/Objective-J/Runtime.js b/Objective-J/Runtime.js index e414f8502..b9de057f6 100644 --- a/Objective-J/Runtime.js +++ b/Objective-J/Runtime.js @@ -47,7 +47,7 @@ GLOBAL(objj_ivar) = function(/*String*/ aName, /*String*/ aType) this.type = aType; } -GLOBAL(objj_method) = function(/*String*/ aName, /*IMP*/ anImplementation, /*String*/ types) +GLOBAL(objj_method) = function(/*String*/ aName, /*IMP*/ anImplementation, /*Array*/ types) { this.name = aName; this.method_imp = anImplementation; @@ -74,6 +74,8 @@ GLOBAL(objj_class) = function(displayName) this.method_store = function() { }; this.method_dtable = this.method_store.prototype; + this.protocol_list = []; + #if DEBUG // Naming the allocator allows the WebKit heap snapshot tool to display object class names correctly // HACK: displayName property is not respected so we must eval a function to name it @@ -85,6 +87,13 @@ GLOBAL(objj_class) = function(displayName) this._UID = -1; } +GLOBAL(objj_protocol) = function(/*String*/ aName) +{ + this.name = aName; + this.instance_methods = { }; + this.class_methods = { }; +} + GLOBAL(objj_object) = function() { this.isa = NULL; @@ -288,6 +297,139 @@ GLOBAL(class_replaceMethod) = function(/*Class*/ aClass, /*SEL*/ aSelector, /*IM return method_imp; } +GLOBAL(class_addProtocol) = function(/*Class*/ aClass, /*Protocol*/ aProtocol) +{ + if (!aProtocol || class_conformsToProtocol(aClass, aProtocol)) + { + return; + } + + (aClass.protocol_list || (aClass.protocol_list == [])).push(aProtocol); + + return true; +} + +GLOBAL(class_conformsToProtocol) = function(/*Class*/ aClass, /*Protocol*/ aProtocol) +{ + if (!aProtocol) + return false; + + while (aClass) + { + var protocols = aClass.protocol_list, + size = protocols ? protocols.length : 0; + + for (var i = 0; i < size; i++) + { + var p = protocols[i]; + + if (p.name === aProtocol.name) + { + return true; + } + if (protocol_conformsToProtocol(p, aProtocol)) + { + return true; + } + } + + aClass = class_getSuperclass(aClass); + } + + return false; +} + +GLOBAL(class_copyProtocolList) = function(/*Class*/ aClass) +{ + var protocols = aClass.protocol_list; + + return protocols ? protocols.slice(0) : []; +} + +GLOBAL(protocol_conformsToProtocol) = function(/*Protocol*/ p1, /*Protocol*/ p2) +{ + if (!p1 || !p2) + return false; + + if (p1.name === p2.name) + return true; + + var protocols = p1.protocol_list, + size = protocols ? protocols.length : 0; + + for (var i = 0; i < size; i++) + { + var p = protocols[i]; + + if (p.name === p2.name) + { + return true; + } + if (protocol_conformsToProtocol(p, p2)) + { + return true; + } + } + + return false; +} + +var REGISTERED_PROTOCOLS = { }; + +GLOBAL(objc_allocateProtocol) = function(/*String*/ aName) +{ + var protocol = new objj_protocol(aName); + + return protocol; +} + +GLOBAL(objc_registerProtocol) = function(/*Protocol*/ proto) +{ + REGISTERED_PROTOCOLS[proto.name] = proto; +} + +GLOBAL(protocol_getName) = function(/*Protocol*/ proto) +{ + return proto.name; +} + +// Right now we only register required methods. THis might need to change in the future +GLOBAL(protocol_addMethodDescription) = function(/*Protocol*/ proto, /*SEL*/ selector, /*Array*/ types, /*BOOL*/ isRequiredMethod, /*BOOL*/ isInstanceMethod) +{ + if (!proto || !selector) return; + + if (isRequiredMethod) + (isInstanceMethod ? proto.instance_methods : proto.class_methods)[selector] = new objj_method(selector, null, types); +} + +GLOBAL(protocol_addMethodDescriptions) = function(/*Protocol*/ proto, /*Array*/ methods, /*BOOL*/ isRequiredMethod, /*BOOL*/ isInstanceMethod) +{ + if (!isRequiredMethod) return; + + var index = 0, + count = methods.length, + method_dtable = isInstanceMethod ? proto.instance_methods : proto.class_methods; + + for (; index < count; ++index) + { + var method = methods[index]; + + method_dtable[method.name] = method; + } +} + +GLOBAL(protocol_copyMethodDescriptionList) = function(/*Protocol*/ proto, /*BOOL*/ isRequiredMethod, /*BOOL*/ isInstanceMethod) +{ + return isRequiredMethod ? (isInstanceMethod ? proto.instance_methods : proto.class_methods).slice(0) : []; +} + +GLOBAL(protocol_addProtocol) = function(/*Protocol*/ proto, /*Protocol*/ addition) +{ + if (!proto || !addition) return; + + (proto.protocol_list || (proto.protocol_list = [])).push(addition); +} + var _class_initialize = function(/*Class*/ aClass) { var meta = GETMETA(aClass); @@ -567,6 +709,13 @@ GLOBAL(objj_getMetaClass) = function(/*String*/ aName) return GETMETA(theClass); } +// Working with Protocol + +GLOBAL(objj_getProtocol) = function(/*String*/ aName) +{ + return REGISTERED_PROTOCOLS[aName]; +} + // Working with Instance Variables GLOBAL(ivar_getName) = function(anIvar) diff --git a/Objective-J/acorn.js b/Objective-J/acorn.js index 8eb0d89f1..6bf3a54a8 100644 --- a/Objective-J/acorn.js +++ b/Objective-J/acorn.js @@ -373,6 +373,8 @@ if (typeof exports != "undefined" && !exports.acorn) { var _action = {keyword: "action"}, _selector = {keyword: "selector"}, _class = {keyword: "class"}, _global = {keyword: "global"}; var _dictionaryLiteral = {keyword: "{"}, _arrayLiteral = {keyword: "["}; var _ref = {keyword: "ref"}, _deref = {keyword: "deref"}; + var _protocol = {keyword: "protocol"}, _optional = {keyword: "optional"}, _required = {keyword: "required"}; + var _interface = {keyword: "interface"}; // Objective-J keywords @@ -418,7 +420,8 @@ if (typeof exports != "undefined" && !exports.acorn) { var objJAtKeywordTypes = {"implementation": _implementation, "outlet": _outlet, "accessors": _accessors, "end": _end, "import": _import, "action": _action, "selector": _selector, "class": _class, "global": _global, - "ref": _ref, "deref": _deref}; + "ref": _ref, "deref": _deref, "protocol": _protocol, "optional": _optional, "required": _required, + "interface": _interface}; // Map Preprocessor keyword names to token types. @@ -2103,7 +2106,7 @@ var preIfLevel = 0; return finishNode(node, "EmptyStatement"); // This is a Objective-J statement - case _implementation: + case _interface: if (options.objj) { next(); node.classname = parseIdent(true); @@ -2122,42 +2125,147 @@ var preIfLevel = 0; node.endOfIvars = tokStart; } node.body = []; + while(!eat(_end)) { + if (tokType === _eof) raise(tokPos, "Expected '@end' after '@interface'"); + node.body.push(parseClassElement()); + } + return finishNode(node, "InterfaceDeclarationStatement"); + } + break; + + // This is a Objective-J statement + case _implementation: + if (options.objj) { + next(); + node.classname = parseIdent(true); + if (eat(_colon)) + node.superclassname = parseIdent(true); + else if (eat(_parenL)) { + node.categoryname = parseIdent(true); + expect(_parenR, "Expected closing ')' after category name"); + } + if (tokVal === '<') { + next(); + var protocols = [], + first = true; + node.protocols = protocols; + while (tokVal !== '>') { + if (!first) + expect(_comma, "Expected ',' between protocol names"); + else first = false; + protocols.push(parseIdent(true)); + } + next(); + } + if (tokVal === '<') { + next(); + var protocols = [], + first = true; + node.protocols = protocols; + while (tokVal !== '>') { + if (!first) + expect(_comma, "Expected ',' between protocol names"); + else first = false; + protocols.push(parseIdent(true)); + } + next(); + } + if (eat(_braceL)) { + node.ivardeclarations = []; + for (;;) { + if (eat(_braceR)) break; + parseIvarDeclaration(node); + } + node.endOfIvars = tokStart; + } + node.body = []; while(!eat(_end)) { if (tokType === _eof) raise(tokPos, "Expected '@end' after '@implementation'"); node.body.push(parseClassElement()); } + return finishNode(node, "ClassDeclarationStatement"); } - return finishNode(node, "ClassDeclarationStatement"); + break; + + // This is a Objective-J statement + case _protocol: + // If next token is a left parenthesis it is a ProtocolLiternal expression so bail out + if (options.objj && input.charCodeAt(tokPos) !== 40) { // '(' + next(); + node.protocolname = parseIdent(true); + if (tokVal === '<') { + next(); + var protocols = [], + first = true; + node.protocols = protocols; + while (tokVal !== '>') { + if (!first) + expect(_comma, "Expected ',' between protocol names"); + else first = false; + protocols.push(parseIdent(true)); + } + next(); + } + while(!eat(_end)) { + if (tokType === _eof) raise(tokPos, "Expected '@end' after '@protocol'"); + if (eat(_optional)) { + while(!eat(_required && tokType !== _end)) { + (node.optional || (node.optional = [])).push(parseProtocolClassElement()); + } + } else { + (node.required || (node.required = [])).push(parseProtocolClassElement()); + } + } + return finishNode(node, "ProtocolDeclarationStatement"); + } + break; // This is a Objective-J statement case _import: - next(); - if (tokType === _string) - node.localfilepath = true; - else if (tokType ===_filename) - node.localfilepath = false; - else - unexpected(); + if (options.objj) { + next(); + if (tokType === _string) + node.localfilepath = true; + else if (tokType ===_filename) + node.localfilepath = false; + else + unexpected(); - node.filename = parseStringNumRegExpLiteral(); - return finishNode(node, "ImportStatement"); + node.filename = parseStringNumRegExpLiteral(); + return finishNode(node, "ImportStatement"); + } + break; // This is a Objective-J statement case _preprocess: - next(); - return finishNode(node, "PreprocessStatement"); + if (options.objj) { + next(); + return finishNode(node, "PreprocessStatement"); + } + break; // This is a Objective-J statement case _class: - next(); - node.id = parseIdent(false); - return finishNode(node, "ClassStatement"); + if (options.objj) { + next(); + node.id = parseIdent(false); + return finishNode(node, "ClassStatement"); + } + break; // This is a Objective-J statement case _global: - next(); - node.id = parseIdent(false); - return finishNode(node, "GlobalStatement"); + if (options.objj) { + next(); + node.id = parseIdent(false); + return finishNode(node, "GlobalStatement"); + } + break; + + } + + // The indentation is one step to the right here to make sure it + // is the same as in the original acorn parser. Easier merge // If the statement does not start with a statement keyword or a // brace, it's an ExpressionStatement or LabeledStatement. We @@ -2165,7 +2273,6 @@ var preIfLevel = 0; // next token is a colon and the expression was a simple // Identifier node, we switch to interpreting it as a label. - default: var maybeName = tokVal, expr = parseExpression(); if (starttype === _name && expr.type === "Identifier" && eat(_colon)) { for (var i = 0; i < labels.length; ++i) @@ -2181,18 +2288,8 @@ var preIfLevel = 0; semicolon(); return finishNode(node, "ExpressionStatement"); } - } } - // CompoundIvarDeclaration = - // IvarType _ IvarDeclaration (_ "," _ IvarDeclaration)* EOS - - // IvarDeclaration = - // Identifier _ Accessors? - - // Accessors = - // "@accessors" ("(" (AccessorsConfiguration (_ "," _ AccessorsConfiguration)*)? ")")? - function parseIvarDeclaration(node) { var outlet; if (eat(_outlet)) @@ -2252,49 +2349,53 @@ var preIfLevel = 0; semicolon(); } - function parseClassElement() { - var methodType = tokVal, - element = startNode(); - if (eat(_plusmin)) { - element.methodtype = methodType; - // If we find a '(' we have a return type to parse + function parseMethodDeclaration(node) { + node.methodtype = tokVal; + expect(_plusmin, "Method declaration must start with '+' or '-'"); + // If we find a '(' we have a return type to parse + if (eat(_parenL)) { + if (eat(_action)) + node.action = true; + if (!eat(_parenR)) { + node.returntype = parseObjectiveJType(); + expect(_parenR, "Expected closing ')' after method return type"); + } + } + // Now we parse the selector + var first = true, + selectors = [], + args = []; + node.selectors = selectors; + node.arguments = args; + for (;;) { + if (tokType !== _colon) { + selectors.push(parseIdent(true)); + if (first && tokType !== _colon) break; + } else + selectors.push(null); + expect(_colon, "Expected ':' in selector"); + var argument = {}; + args.push(argument); if (eat(_parenL)) { - if (eat(_action)) - element.action = true; - if (!eat(_parenR)) { - element.returntype = parseObjectiveJType(); - expect(_parenR, "Expected closing ')' after method return type"); - } + argument.type = parseObjectiveJType(); + expect(_parenR, "Expected closing ')' after method argument type"); } - // Now we parse the selector - var first = true, - selectors = [], - args = []; - element.selectors = selectors; - element.arguments = args; - for (;;) { - if (tokType !== _colon) { - selectors.push(parseIdent(true)); - if (first && tokType !== _colon) break; - } else - selectors.push(null); - expect(_colon, "Expected ':' in selector"); - var argument = {}; - args.push(argument); - if (eat(_parenL)) { - argument.type = parseObjectiveJType(); - expect(_parenR, "Expected closing ')' after method argument type"); - } - argument.identifier = parseIdent(false); - if (tokType === _braceL || eat(_semi)) break; - if (eat(_comma)) { - expect(_dotdotdot, "Expected '...' after ',' in method declaration"); - element.parameters = true; - break; - } - first = false; + argument.identifier = parseIdent(false); + if (tokType === _braceL || tokType === _semi) break; + if (eat(_comma)) { + expect(_dotdotdot, "Expected '...' after ',' in method declaration"); + node.parameters = true; + break; } + first = false; + } + } + function parseClassElement() { + var element = startNode(); + if (tokVal === '+' || tokVal === '-') { + parseMethodDeclaration(element); + eat(_semi); element.startOfBody = lastEnd; // Start a new scope with regard to labels and the `inFunction` // flag (restore them to their old value afterwards). @@ -2307,6 +2408,14 @@ var preIfLevel = 0; return parseStatement(); } + function parseProtocolClassElement() { + var element = startNode(); + parseMethodDeclaration(element); + + semicolon(); + return finishNode(element, "MethodDeclarationStatement"); + } + // Used for constructs like `switch` and `if` that insist on // parentheses around their expression. @@ -2622,6 +2731,14 @@ var preIfLevel = 0; expect(_parenR, "Expected closing ')' after selector"); return finishNode(node, "SelectorLiteralExpression"); + case _protocol: + var node = startNode(); + next(); + expect(_parenL, "Expected '(' after '@protocol'"); + node.id = parseIdent(true); + expect(_parenR, "Expected closing ')' after protocol name"); + return finishNode(node, "ProtocolLiteralExpression"); + case _ref: var node = startNode(); next(); @@ -2878,12 +2995,21 @@ var preIfLevel = 0; function parseObjectiveJType() { var node = startNode(); if (tokType === _name) { - node.name = tokVal; + var type = tokVal; + node.name = type; next(); - if (tokVal === '<') { - next(); - node.protocol = parseIdent(true); - if (tokVal !== '>') unexpected(); + if (type === "id" && tokVal === '<') { + var first = true, + protocols = []; + node.protocols = protocols; + do { + next(); + if (first) + first = false; + else + eat(_comma); + protocols.push(parseIdent(true)); + } while (tokVal !== '>'); next(); } } else { diff --git a/Objective-J/acornwalk.js b/Objective-J/acornwalk.js index b1fa478d4..87753e3f4 100644 --- a/Objective-J/acornwalk.js +++ b/Objective-J/acornwalk.js @@ -208,14 +208,23 @@ if (!exports.acorn) { exports.IvarDeclaration = ignore; - exports.MethodDeclarationStatement = ignore; - exports.PreprocessStatement = ignore; exports.ClassStatement = ignore; exports.GlobalStatement = ignore; + exports.ProtocolDeclarationStatement = function(node, st, c) { + if (node.required) for (var i = 0; i < node.required.length; ++i) { + c(node.required[i], st, "Statement"); + } + if (node.optional) for (var i = 0; i < node.optional.length; ++i) { + c(node.optional[i], st, "Statement"); + } + } + exports.MethodDeclarationStatement = function(node, st, c) { - c(node.body, st, "Statement"); + var body = node.body; + if (body) + c(body, st, "Statement"); } exports.MessageSendExpression = function(node, st, c) { @@ -227,6 +236,7 @@ if (!exports.acorn) { } exports.SelectorLiteralExpression = ignore; + exports.ProtocolLiteralExpression = ignore; exports.Reference = function(node, st, c) { c(node.element, st, "Identifier"); diff --git a/Tests/Objective-J/Preprocessor/BehaviorTests/ProtocolTest.j b/Tests/Objective-J/Preprocessor/BehaviorTests/ProtocolTest.j new file mode 100644 index 000000000..36a1a078d --- /dev/null +++ b/Tests/Objective-J/Preprocessor/BehaviorTests/ProtocolTest.j @@ -0,0 +1,72 @@ +@import + +@protocol MyProtocol + +- (int)myFunction:(int)aValue; + +@end + +@protocol MyProtocol2 + +- (int)myFunction2:(int)aValue; + +@end + +@protocol MyProtocol3 + +- (int)myFunction3:(int)aValue; + +@end + +@implementation MyClass : CPObject + +- (int)myOtherFunction:(int)aValue +{ + return aValue * 2; +} + +- (int)myFunction:(int)aValue +{ + return aValue * 2; +} + +@end + +@implementation MyClass2 : CPObject + +- (int)myOtherFunction:(int)aValue +{ + return aValue * 2; +} + +- (int)myFunction:(int)aValue +{ + return aValue * 2; +} + +- (int)myFunction2:(int)aValue +{ + return aValue * 2; +} + +- (int)myFunction3:(int)aValue +{ + return aValue * 2; +} + +@end + + +@implementation ProtocolTest : OJTestCase + +- (void)testConformsToProtocol +{ + [self assert:true equals:[[[MyClass alloc] init] conformsToProtocol:@protocol(MyProtocol)]]; + [self assert:false equals:[[[MyClass alloc] init] conformsToProtocol:@protocol(MyProtocol2)]]; + [self assert:false equals:[[[MyClass alloc] init] conformsToProtocol:@protocol(xxxxxx)]]; + [self assert:true equals:[[[MyClass2 alloc] init] conformsToProtocol:@protocol(MyProtocol)]]; + [self assert:true equals:[[[MyClass2 alloc] init] conformsToProtocol:@protocol(MyProtocol2)]]; + [self assert:true equals:[[[MyClass2 alloc] init] conformsToProtocol:@protocol(MyProtocol3)]]; +} + +@end From 7c2c2a3114bdd4db60ab96f5a7a3f43e01582abc Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Mon, 12 Aug 2013 09:40:20 +0200 Subject: [PATCH 02/25] Fixed: Allow protocols in interface declaration --- Objective-J/acorn.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Objective-J/acorn.js b/Objective-J/acorn.js index 6bf3a54a8..9724bf05d 100644 --- a/Objective-J/acorn.js +++ b/Objective-J/acorn.js @@ -2116,6 +2116,19 @@ var preIfLevel = 0; node.categoryname = parseIdent(true); expect(_parenR, "Expected closing ')' after category name"); } + if (tokVal === '<') { + next(); + var protocols = [], + first = true; + node.protocols = protocols; + while (tokVal !== '>') { + if (!first) + expect(_comma, "Expected ',' between protocol names"); + else first = false; + protocols.push(parseIdent(true)); + } + next(); + } if (eat(_braceL)) { node.ivardeclarations = []; for (;;) { From 1cfc8139b9bf3605b3bc406c9bc7e6ae1cea7460 Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Mon, 12 Aug 2013 16:39:54 +0200 Subject: [PATCH 03/25] Fixed: Removed double declared ivar --- AppKit/CPSliderColorPicker.j | 1 - 1 file changed, 1 deletion(-) diff --git a/AppKit/CPSliderColorPicker.j b/AppKit/CPSliderColorPicker.j index 7e7f997b4..7345042ea 100644 --- a/AppKit/CPSliderColorPicker.j +++ b/AppKit/CPSliderColorPicker.j @@ -55,7 +55,6 @@ CPTextField _hexLabel; CPTextField _hexValue; - CPTextField _hexValue; CPTextField _redValue; CPTextField _greenValue; CPTextField _blueValue; From bb58a206a8405978cd2eb3c708e12e4774d719e2 Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Mon, 12 Aug 2013 16:46:14 +0200 Subject: [PATCH 04/25] Fixed: Removed all warnings of conflicting return and parameter types caused by the new compiler --- AppKit/CPAlert.j | 2 +- AppKit/CPBox.j | 2 +- AppKit/CPBrowser.j | 8 +++---- AppKit/CPButton.j | 2 +- AppKit/CPButtonBar.j | 2 +- AppKit/CPCollectionView.j | 6 ++--- AppKit/CPColorPanel.j | 4 ++-- AppKit/CPColorWell.j | 2 +- AppKit/CPComboBox.j | 10 ++++---- AppKit/CPControl.j | 6 ++--- AppKit/CPDatePicker/CPDatePicker.j | 6 ++--- AppKit/CPDatePicker/_CPDatePickerCalendar.j | 4 ++-- AppKit/CPDatePicker/_CPDatePickerTextField.j | 4 ++-- AppKit/CPFlashView.j | 2 +- AppKit/CPImageView.j | 4 ++-- AppKit/CPLevelIndicator.j | 2 +- AppKit/CPMenu/CPMenu.j | 8 +++---- AppKit/CPMenu/_CPMenuWindow.j | 2 +- AppKit/CPMenuItem/_CPMenuItemMenuBarView.j | 2 +- AppKit/CPMenuItem/_CPMenuItemStandardView.j | 2 +- AppKit/CPMenuItem/_CPMenuItemView.j | 2 +- AppKit/CPObjectController.j | 10 ++++---- AppKit/CPOutlineView.j | 6 ++--- AppKit/CPPopUpButton.j | 10 ++++---- AppKit/CPRadio.j | 2 +- AppKit/CPRuleEditor/CPPredicateEditor.j | 8 +++---- AppKit/CPRuleEditor/CPRuleEditor.j | 24 +++++++++---------- .../CPRuleEditor/_CPRuleEditorPopUpButton.j | 8 +++---- .../CPRuleEditor/_CPRuleEditorViewSliceRow.j | 2 +- AppKit/CPScroller.j | 2 +- AppKit/CPSearchField.j | 2 +- AppKit/CPSegmentedControl.j | 2 +- AppKit/CPShadowView.j | 2 +- AppKit/CPSlider.j | 2 +- AppKit/CPSplitView.j | 4 ++-- AppKit/CPStepper.j | 4 ++-- AppKit/CPTabView.j | 6 ++--- AppKit/CPTableColumn.j | 2 +- AppKit/CPTableHeaderView.j | 6 ++--- AppKit/CPTableView.j | 12 +++++----- AppKit/CPTextField.j | 4 ++-- AppKit/CPTokenField.j | 10 ++++---- AppKit/CPToolbar.j | 4 ++-- AppKit/CPViewAnimation.j | 2 +- AppKit/CPWindow/CPWindow.j | 2 +- .../CPWindow/_CPBorderlessBridgeWindowView.j | 2 +- AppKit/CPWindow/_CPDocModalWindowView.j | 2 +- AppKit/CPWindow/_CPPopoverWindowView.j | 2 +- AppKit/CPWindow/_CPShadowWindowView.j | 2 +- AppKit/CPWindow/_CPStandardWindowView.j | 4 ++-- AppKit/CPWindow/_CPToolTipWindowView.j | 2 +- AppKit/CPWindow/_CPWindowView.j | 2 +- AppKit/CoreAnimation/CALayer.j | 2 +- AppKit/CoreAnimation/CAMediaTimingFunction.j | 2 +- AppKit/Platform/DOM/CPDOMWindowLayer.j | 2 +- AppKit/_CPAutocompleteMenu.j | 2 +- AppKit/_CPCornerView.j | 2 +- AppKit/_CPImageAndTextView.j | 2 +- AppKit/_CPPopUpList.j | 2 +- AppKit/_CPPopoverWindow.j | 2 +- CONTRIBUTING.md | 2 +- Foundation/CPArray+KVO.j | 20 ++++++++-------- Foundation/CPArray/CPMutableArray.j | 14 +++++------ Foundation/CPArray/_CPArray.j | 10 ++++---- Foundation/CPArray/_CPJavaScriptArray.j | 12 +++++----- Foundation/CPAttributedString.j | 10 ++++---- Foundation/CPByteCountFormatter.j | 2 +- Foundation/CPDateFormatter.j | 2 +- Foundation/CPDecimalNumber.j | 15 +++++++++++- Foundation/CPError.j | 2 +- Foundation/CPIndexSet.j | 2 +- Foundation/CPInvocation.j | 4 ++-- Foundation/CPKeyValueObserving.j | 4 ++-- Foundation/CPNumberFormatter.j | 2 +- Foundation/CPScanner.j | 2 +- Foundation/CPSet+KVO.j | 2 +- Foundation/CPString.j | 6 ++--- Tests/AppKit/CPArrayControllerTest.j | 8 +++---- Tests/Foundation/CPAttributedStringTest.j | 6 ++--- Tests/Foundation/CPKVOTest.j | 6 ++--- Tests/Manual/ArrayController1/AppController.j | 8 +++---- Tools/nib2cib/NSCustomView.j | 2 +- 82 files changed, 202 insertions(+), 189 deletions(-) diff --git a/AppKit/CPAlert.j b/AppKit/CPAlert.j index 5f8db4129..28edbe53d 100644 --- a/AppKit/CPAlert.j +++ b/AppKit/CPAlert.j @@ -757,7 +757,7 @@ var bottomHeight = 71; return @"alert"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"size": CGSizeMake(400.0, 110.0), diff --git a/AppKit/CPBox.j b/AppKit/CPBox.j index 0a9240d7b..dc10564ff 100644 --- a/AppKit/CPBox.j +++ b/AppKit/CPBox.j @@ -76,7 +76,7 @@ CPBelowBottom = 6; return @"box"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"background-color": [CPNull null], diff --git a/AppKit/CPBrowser.j b/AppKit/CPBrowser.j index 094bb6a5b..0c764943b 100644 --- a/AppKit/CPBrowser.j +++ b/AppKit/CPBrowser.j @@ -71,7 +71,7 @@ return "browser"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"image-control-resize": [CPNull null], @@ -771,7 +771,7 @@ CPBrowser _browser @accessors; } -- (void)initWithFrame:(CGRect)aFrame +- (id)initWithFrame:(CGRect)aFrame { if (self = [super initWithFrame:aFrame]) { @@ -902,7 +902,7 @@ [_browser selectRowIndexes:selectedIndexes inColumn:_index]; } -- (id)childAtIndex:(unsigned)index +- (id)childAtIndex:(CPUInteger)index { return [_delegate browser:_browser child:index ofItem:_item]; } @@ -995,7 +995,7 @@ [aCoder encodeObject:_highlightedBranchImage forKey:"_CPBrowserLeafViewHighlightedBranchImageKey"]; } -- (void)initWithCoder:(CPCoder)aCoder +- (id)initWithCoder:(CPCoder)aCoder { if (self = [super initWithCoder:aCoder]) { diff --git a/AppKit/CPButton.j b/AppKit/CPButton.j index 25f1424ff..86ac3b33e 100644 --- a/AppKit/CPButton.j +++ b/AppKit/CPButton.j @@ -149,7 +149,7 @@ CPButtonImageOffset = 3.0; return @"button"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"image": [CPNull null], diff --git a/AppKit/CPButtonBar.j b/AppKit/CPButtonBar.j index c96a01d76..8efe075b4 100644 --- a/AppKit/CPButtonBar.j +++ b/AppKit/CPButtonBar.j @@ -79,7 +79,7 @@ return @"button-bar"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"resize-control-inset": CGInsetMake(0.0, 0.0, 0.0, 0.0), diff --git a/AppKit/CPCollectionView.j b/AppKit/CPCollectionView.j index 1412cf40e..725cafe13 100644 --- a/AppKit/CPCollectionView.j +++ b/AppKit/CPCollectionView.j @@ -892,12 +892,12 @@ var HORIZONTAL_MARGIN = 2; return CPNotFound; } -- (CPCollectionViewItem)itemAtIndex:(unsigned)anIndex +- (CPCollectionViewItem)itemAtIndex:(CPUInteger)anIndex { return [_items objectAtIndex:anIndex]; } -- (CGRect)frameForItemAtIndex:(unsigned)anIndex +- (CGRect)frameForItemAtIndex:(CPUInteger)anIndex { return [[[self itemAtIndex:anIndex] view] frame]; } @@ -1322,7 +1322,7 @@ Not supported. Use -collectionView:dataForItemsAtIndexes:fortype: [self interpretKeyEvents:[anEvent]]; } -- (void)setAutoresizingMask:(int)aMask +- (void)setAutoresizingMask:(unsigned)aMask { [super setAutoresizingMask:0]; } diff --git a/AppKit/CPColorPanel.j b/AppKit/CPColorPanel.j index 0a3f6ba88..af6bf3e1d 100644 --- a/AppKit/CPColorPanel.j +++ b/AppKit/CPColorPanel.j @@ -576,7 +576,7 @@ var CPColorPanelSwatchesCookie = "CPColorPanelSwatchesCookie"; [aPasteboard setData:[CPKeyedArchiver archivedDataWithRootObject:_dragColor] forType:aType]; } -- (void)performDragOperation:(id )aSender +- (void)performDragOperation:(id /**/)aSender { var location = [self convertPoint:[aSender draggingLocation] fromView:nil], pasteboard = [aSender draggingPasteboard], @@ -615,7 +615,7 @@ var CPColorPanelSwatchesCookie = "CPColorPanelSwatchesCookie"; return _colorPanel; } -- (void)performDragOperation:(id )aSender +- (void)performDragOperation:(id /**/)aSender { var pasteboard = [aSender draggingPasteboard]; diff --git a/AppKit/CPColorWell.j b/AppKit/CPColorWell.j index 8ebe88ce9..8d8132f3a 100644 --- a/AppKit/CPColorWell.j +++ b/AppKit/CPColorWell.j @@ -58,7 +58,7 @@ var _CPColorWellDidBecomeExclusiveNotification = @"_CPColorWellDidBecomeExclusiv return @"colorwell"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"bezel-inset": CGInsetMakeZero(), diff --git a/AppKit/CPComboBox.j b/AppKit/CPComboBox.j index 0651d53ee..272292fe3 100644 --- a/AppKit/CPComboBox.j +++ b/AppKit/CPComboBox.j @@ -58,7 +58,7 @@ var CPComboBoxTextSubview = @"text", return "combobox"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"popup-button-size": CGSizeMake(21.0, 29.0), @@ -171,7 +171,7 @@ var CPComboBoxTextSubview = @"text", #pragma mark Setting a Delegate -- (id < CPComboBoxDelegate >)delegate +- (id /*< CPComboBoxDelegate >*/)delegate { return [super delegate]; } @@ -182,7 +182,7 @@ var CPComboBoxTextSubview = @"text", protocol, in actual fact it doesn't. Also note that the same delegate may conform to the NSTextFieldDelegate protocol. */ -- (void)setDelegate:(id < CPComboBoxDelegate >)aDelegate +- (void)setDelegate:(id /*< CPComboBoxDelegate >*/)aDelegate { var delegate = [self delegate]; @@ -231,7 +231,7 @@ var CPComboBoxTextSubview = @"text", #pragma mark Setting a Data Source -- (id < CPComboBoxDataSource >)dataSource +- (id /*< CPComboBoxDataSource >*/)dataSource { if (!_usesDataSource) [self _dataSourceWarningForMethod:_cmd condition:NO]; @@ -239,7 +239,7 @@ var CPComboBoxTextSubview = @"text", return _dataSource; } -- (void)setDataSource:(id < CPComboBoxDataSource >)aSource +- (void)setDataSource:(id /*< CPComboBoxDataSource >*/)aSource { if (!_usesDataSource) [self _dataSourceWarningForMethod:_cmd condition:NO]; diff --git a/AppKit/CPControl.j b/AppKit/CPControl.j index 5460748e5..a8f61fa4f 100644 --- a/AppKit/CPControl.j +++ b/AppKit/CPControl.j @@ -322,11 +322,11 @@ var CPControlBlackColor = [CPColor blackColor]; _previousTrackingLocation = currentLocation; } -- (void)setState:(int)state +- (void)setState:(CPInteger)state { } -- (int)nextState +- (CPInteger)nextState { return 0; } @@ -813,7 +813,7 @@ var CPControlBlackColor = [CPColor blackColor]; /*! Returns the image scaling of the control. */ -- (CPImageScaling)imageScaling +- (CPUInteger)imageScaling { return [self valueForThemeAttribute:@"image-scaling"]; } diff --git a/AppKit/CPDatePicker/CPDatePicker.j b/AppKit/CPDatePicker/CPDatePicker.j index 0c9b26633..a96b75ccc 100644 --- a/AppKit/CPDatePicker/CPDatePicker.j +++ b/AppKit/CPDatePicker/CPDatePicker.j @@ -90,7 +90,7 @@ CPEraDatePickerElementFlag = 0x0100; return @"datePicker"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"bezel-color": [CPColor clearColor], @@ -159,7 +159,7 @@ CPEraDatePickerElementFlag = 0x0100; return [super _binderClassForBinding:theBinding]; } -- (id)_replacementKeyPathForBinding:(CPString)aBinding +- (CPString)_replacementKeyPathForBinding:(CPString)aBinding { if (aBinding == CPValueBinding) return @"dateValue"; @@ -269,7 +269,7 @@ CPEraDatePickerElementFlag = 0x0100; /*! Return the objectValue of the datePicker. The objectValue should take the timeZoneEffect */ -- (void)objectValue +- (id)objectValue { // TODO : add timeZone effect. How to do it because js ??? return _dateValue diff --git a/AppKit/CPDatePicker/_CPDatePickerCalendar.j b/AppKit/CPDatePicker/_CPDatePickerCalendar.j index 474d29665..a7d713585 100644 --- a/AppKit/CPDatePicker/_CPDatePickerCalendar.j +++ b/AppKit/CPDatePicker/_CPDatePickerCalendar.j @@ -1059,7 +1059,7 @@ var CPShortWeekDayNameArrayEn = [@"Mo", @"Tu", @"We", @"Th", @"Fr", @"Sa", @"Su" /*! Set a theme */ -- (void)setThemeState:(CPThemeState)aState +- (BOOL)setThemeState:(CPThemeState)aState { [_textField setThemeState:aState]; [super setThemeState:aState]; @@ -1067,7 +1067,7 @@ var CPShortWeekDayNameArrayEn = [@"Mo", @"Tu", @"We", @"Th", @"Fr", @"Sa", @"Su" /*! Unset a theme */ -- (void)unsetThemeState:(CPThemeState)aState +- (BOOL)unsetThemeState:(CPThemeState)aState { [_textField unsetThemeState:aState]; [super unsetThemeState:aState]; diff --git a/AppKit/CPDatePicker/_CPDatePickerTextField.j b/AppKit/CPDatePicker/_CPDatePickerTextField.j index 897dc14d0..59033f99e 100644 --- a/AppKit/CPDatePicker/_CPDatePickerTextField.j +++ b/AppKit/CPDatePicker/_CPDatePickerTextField.j @@ -1356,7 +1356,7 @@ var CPMonthDateType = 0, /*! Set the stringValue of the TextField. Add some zeros of there isn't 2/4 letters in the value. It's called at the end of the editing process @param aStringValue a CPString */ -- (void)setStringValue:(id)aStringValue +- (void)setStringValue:(CPString)aStringValue { if (_dateType == CPYearDateType) { @@ -1437,7 +1437,7 @@ var CPMonthDateType = 0, /*! Return the objectValue of the textField. Needed for the binding. This returns the objectValue relative to the dateValue */ -- (void)objectValue +- (id)objectValue { var dateValue = [[_datePicker dateValue] copy]; diff --git a/AppKit/CPFlashView.j b/AppKit/CPFlashView.j index 071ad0ee2..13cc481a2 100644 --- a/AppKit/CPFlashView.j +++ b/AppKit/CPFlashView.j @@ -189,7 +189,7 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"; return @"CPFV_" + [self UID]; } -- (void)mouseMoved:(id)sommit +- (void)mouseMoved:(CPEvent)sommit { [[[self window] platformWindow] _propagateCurrentDOMEvent:YES]; } diff --git a/AppKit/CPImageView.j b/AppKit/CPImageView.j index 1cac97d16..5f92e0fe9 100644 --- a/AppKit/CPImageView.j +++ b/AppKit/CPImageView.j @@ -267,7 +267,7 @@ var CPImageViewEmptyPlaceholderImage = nil; [self setNeedsDisplay:YES]; } -- (unsigned)imageScaling +- (CPUInteger)imageScaling { return [self currentValueForThemeAttribute:@"image-scaling"]; } @@ -502,7 +502,7 @@ var CPImageViewEmptyPlaceholderImage = nil; [_source setImage:image]; } -- (void)valueForBinding:(CPString)aBinding +- (id)valueForBinding:(CPString)aBinding { var image = [_source image]; diff --git a/AppKit/CPLevelIndicator.j b/AppKit/CPLevelIndicator.j index 92a631c42..042b17e84 100644 --- a/AppKit/CPLevelIndicator.j +++ b/AppKit/CPLevelIndicator.j @@ -62,7 +62,7 @@ CPRatingLevelIndicatorStyle = 3; return "level-indicator"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"bezel-color": [CPNull null], diff --git a/AppKit/CPMenu/CPMenu.j b/AppKit/CPMenu/CPMenu.j index 1940827ee..d38f8b067 100644 --- a/AppKit/CPMenu/CPMenu.j +++ b/AppKit/CPMenu/CPMenu.j @@ -278,7 +278,7 @@ var _CPMenuBarVisible = NO, @param aMenuItem the item to insert @param anIndex the index in the menu to insert the item. */ -- (void)insertItem:(CPMenuItem)aMenuItem atIndex:(unsigned)anIndex +- (void)insertItem:(CPMenuItem)aMenuItem atIndex:(CPUInteger)anIndex { [self insertObject:aMenuItem inItemsAtIndex:anIndex]; } @@ -291,7 +291,7 @@ var _CPMenuBarVisible = NO, @param anIndex the index location in the menu for the new item @return the new menu item */ -- (CPMenuItem)insertItemWithTitle:(CPString)aTitle action:(SEL)anAction keyEquivalent:(CPString)aKeyEquivalent atIndex:(unsigned)anIndex +- (CPMenuItem)insertItemWithTitle:(CPString)aTitle action:(SEL)anAction keyEquivalent:(CPString)aKeyEquivalent atIndex:(CPUInteger)anIndex { var item = [[CPMenuItem alloc] initWithTitle:aTitle action:anAction keyEquivalent:aKeyEquivalent]; @@ -335,7 +335,7 @@ var _CPMenuBarVisible = NO, Removes the item at the specified index from the menu @param anIndex the index of the item to remove */ -- (void)removeItemAtIndex:(unsigned)anIndex +- (void)removeItemAtIndex:(CPUInteger)anIndex { [self removeObjectFromItemsAtIndex:anIndex]; } @@ -1060,7 +1060,7 @@ var _CPMenuBarVisible = NO, Sends the action of the menu item at the specified index. @param anIndex the index of the item */ -- (void)performActionForItemAtIndex:(unsigned)anIndex +- (void)performActionForItemAtIndex:(CPUInteger)anIndex { var item = _items[anIndex]; diff --git a/AppKit/CPMenu/_CPMenuWindow.j b/AppKit/CPMenu/_CPMenuWindow.j index 19cf4d6f7..61c065e43 100644 --- a/AppKit/CPMenu/_CPMenuWindow.j +++ b/AppKit/CPMenu/_CPMenuWindow.j @@ -434,7 +434,7 @@ _CPMenuWindowAttachedMenuBackgroundStyle = 2; return "menu-view"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"menu-window-more-above-image": [CPNull null], diff --git a/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j b/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j index 8d213511d..07e80745b 100644 --- a/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j +++ b/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j @@ -49,7 +49,7 @@ return "menu-item-bar-view"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"horizontal-margin": 9.0, diff --git a/AppKit/CPMenuItem/_CPMenuItemStandardView.j b/AppKit/CPMenuItem/_CPMenuItemStandardView.j index 4eaca118d..2fc534b24 100644 --- a/AppKit/CPMenuItem/_CPMenuItemStandardView.j +++ b/AppKit/CPMenuItem/_CPMenuItemStandardView.j @@ -45,7 +45,7 @@ return "menu-item-standard-view"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"submenu-indicator-color": [CPNull null], diff --git a/AppKit/CPMenuItem/_CPMenuItemView.j b/AppKit/CPMenuItem/_CPMenuItemView.j index 568ba9d77..7156db2ed 100644 --- a/AppKit/CPMenuItem/_CPMenuItemView.j +++ b/AppKit/CPMenuItem/_CPMenuItemView.j @@ -53,7 +53,7 @@ return "menu-item-view"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{}; } diff --git a/AppKit/CPObjectController.j b/AppKit/CPObjectController.j index 497d35aed..ebdfcb43e 100644 --- a/AppKit/CPObjectController.j +++ b/AppKit/CPObjectController.j @@ -51,7 +51,7 @@ CPCountedSet _observedKeys; } -+ (id)initialize ++ (void)initialize { if (self !== [CPObjectController class]) return; @@ -572,7 +572,7 @@ var CPObjectControllerContentKey = @"CPObjectControllerCo } } -- (void)insertObject:(id)anObject atIndex:(unsigned)anIndex +- (void)insertObject:(id)anObject atIndex:(CPUInteger)anIndex { for (var i = 0, count = [_observationProxies count]; i < count; i++) { @@ -592,7 +592,7 @@ var CPObjectControllerContentKey = @"CPObjectControllerCo [super insertObject:anObject atIndex:anIndex]; } -- (void)removeObjectAtIndex:(unsigned)anIndex +- (void)removeObjectAtIndex:(CPUInteger)anIndex { var currentObject = [self objectAtIndex:anIndex]; @@ -614,7 +614,7 @@ var CPObjectControllerContentKey = @"CPObjectControllerCo [super removeObjectAtIndex:anIndex]; } -- (_CPObservableArray)objectsAtIndexes:(CPIndexSet)theIndexes +- (CPArray)objectsAtIndexes:(CPIndexSet)theIndexes { return [_CPObservableArray arrayWithArray:[super objectsAtIndexes:theIndexes]]; } @@ -629,7 +629,7 @@ var CPObjectControllerContentKey = @"CPObjectControllerCo [self removeObjectAtIndex:[self count]]; } -- (void)replaceObjectAtIndex:(unsigned)anIndex withObject:(id)anObject +- (void)replaceObjectAtIndex:(CPUInteger)anIndex withObject:(id)anObject { var currentObject = [self objectAtIndex:anIndex]; diff --git a/AppKit/CPOutlineView.j b/AppKit/CPOutlineView.j index efbf19d09..e0d7f1c3a 100644 --- a/AppKit/CPOutlineView.j +++ b/AppKit/CPOutlineView.j @@ -1803,7 +1803,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt return [_outlineView itemAtRow:theRow]; } -- (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(id < CPDraggingInfo >)theInfo +- (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(id /*< CPDraggingInfo >*/)theInfo proposedRow:(int)theRow proposedDropOperation:(CPTableViewDropOperation)theOperation { if (!(_outlineView._implementedOutlineViewDataSourceMethods & CPOutlineViewDataSource_outlineView_validateDrop_proposedItem_proposedChildIndex_)) @@ -1823,7 +1823,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt return [_outlineView._outlineViewDataSource outlineView:_outlineView validateDrop:theInfo proposedItem:parentItem proposedChildIndex:childIndex]; } -- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id )theInfo row:(int)theRow dropOperation:(CPTableViewDropOperation)theOperation +- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id /**/)theInfo row:(int)theRow dropOperation:(CPTableViewDropOperation)theOperation { if (!(_outlineView._implementedOutlineViewDataSourceMethods & CPOutlineViewDataSource_outlineView_acceptDrop_item_childIndex_)) return NO; @@ -1940,7 +1940,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt return self; } -- (void)setState:(CPState)aState +- (void)setState:(CPInteger)aState { [super setState:aState]; diff --git a/AppKit/CPPopUpButton.j b/AppKit/CPPopUpButton.j index 08800bf1b..01b1d7532 100644 --- a/AppKit/CPPopUpButton.j +++ b/AppKit/CPPopUpButton.j @@ -279,7 +279,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down"); Selects the item at the specified index @param anIndex the index of the item to select */ -- (void)setObjectValue:(int)anIndex +- (void)setObjectValue:(id)anIndex { var indexOfSelectedItem = [self objectValue]; @@ -344,7 +344,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down"); Returns the item at the specified index or \c nil if the item does not exist. @param anIndex the index of the item to obtain */ -- (CPMenuItem)itemAtIndex:(unsigned)anIndex +- (CPMenuItem)itemAtIndex:(CPUInteger)anIndex { return [[self menu] itemAtIndex:anIndex]; } @@ -353,7 +353,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down"); Returns the title of the item at the specified index or \c nil if no item exists. @param anIndex the index of the item */ -- (CPString)itemTitleAtIndex:(unsigned)anIndex +- (CPString)itemTitleAtIndex:(CPUInteger)anIndex { return [[[self menu] itemAtIndex:anIndex] title]; } @@ -838,7 +838,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down"); [self _setContentValuesIfNeeded:contentArray]; } -- (void)valueForBinding:(CPString)aBinding +- (id)valueForBinding:(CPString)aBinding { return [self _content]; } @@ -910,7 +910,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down"); { } -- (void)setValue:(id)aValue forBinding:(CPString)aBinding +- (void)setValue:(CPArray)aValue forBinding:(CPString)aBinding { [super _setContent:aValue]; } diff --git a/AppKit/CPRadio.j b/AppKit/CPRadio.j index 3953b790d..446578c7c 100644 --- a/AppKit/CPRadio.j +++ b/AppKit/CPRadio.j @@ -152,7 +152,7 @@ CPRadioImageOffset = 4.0; [_radioGroup _setSelectedRadio:self]; } -- (void)sendAction:(SEL)anAction to:(id)anObject +- (BOOL)sendAction:(SEL)anAction to:(id)anObject { [super sendAction:anAction to:anObject]; diff --git a/AppKit/CPRuleEditor/CPPredicateEditor.j b/AppKit/CPRuleEditor/CPPredicateEditor.j index 097d4f1b1..989268203 100644 --- a/AppKit/CPRuleEditor/CPPredicateEditor.j +++ b/AppKit/CPRuleEditor/CPPredicateEditor.j @@ -484,7 +484,7 @@ #pragma mark RuleEditor delegate methods -- (int)_queryNumberOfChildrenOfItem:(id)rowItem withRowType:(int)type +- (int)_queryNumberOfChildrenOfItem:(id)rowItem withRowType:(CPRuleEditorRowType)type { if (rowItem == nil) { @@ -494,7 +494,7 @@ return [[rowItem children] count]; } -- (id)_queryChild:(int)childIndex ofItem:(id)rowItem withRowType:(int)type +- (id)_queryChild:(int)childIndex ofItem:(id)rowItem withRowType:(CPRuleEditorRowType)type { if (rowItem == nil) { @@ -516,7 +516,7 @@ var CPPredicateTemplatesKey = @"CPPredicateTemplates"; @implementation CPPredicateEditor (CPCoding) -- (id)initWithCoder:(id)aCoder +- (id)initWithCoder:(CPCoder)aCoder { self = [super initWithCoder:aCoder]; @@ -531,7 +531,7 @@ var CPPredicateTemplatesKey = @"CPPredicateTemplates"; return self; } -- (void)encodeWithCoder:(id)aCoder +- (void)encodeWithCoder:(CPCoder)aCoder { [super encodeWithCoder:aCoder]; [aCoder encodeObject:_allTemplates forKey:CPPredicateTemplatesKey]; diff --git a/AppKit/CPRuleEditor/CPRuleEditor.j b/AppKit/CPRuleEditor/CPRuleEditor.j index 738af0e2d..df5733536 100644 --- a/AppKit/CPRuleEditor/CPRuleEditor.j +++ b/AppKit/CPRuleEditor/CPRuleEditor.j @@ -122,7 +122,7 @@ var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType", return @"rule-editor"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"alternating-row-colors": [CPNull null], @@ -1684,7 +1684,7 @@ TODO: implement [super bind:aBinding toObject:observableController withKeyPath:aKeyPath options:options]; } -- (void)unbind:(id)object +- (void)unbind:(CPString)object { _rowClass = [_CPRuleEditorRowObject class]; [super unbind:object]; @@ -2128,7 +2128,7 @@ TODO: implement return YES; } -- (CPDragOperation)draggingEntered:(id < CPDraggingInfo >)sender +- (CPDragOperation)draggingEntered:(id /*< CPDraggingInfo >*/)sender { if ([sender draggingSource] === self) { @@ -2158,7 +2158,7 @@ TODO: implement _subviewIndexOfDropLine = CPNotFound; } -- (CPDragOperation)draggingUpdated:(id )sender +- (CPDragOperation)draggingUpdated:(id /**/)sender { var point = [self convertPoint:[sender draggingLocation] fromView:nil], y = point.y + _sliceHeight / 2, @@ -2195,12 +2195,12 @@ TODO: implement return CPDragOperationMove; } -- (BOOL)prepareForDragOperation:(id < CPDraggingInfo >)sender +- (BOOL)prepareForDragOperation:(id /*< CPDraggingInfo >*/)sender { return (_subviewIndexOfDropLine !== CPNotFound); } -- (BOOL)performDragOperation:(id < CPDraggingInfo >)info +- (BOOL)performDragOperation:(id /*< CPDraggingInfo >*/)info { var aboveInsertIndexCount = 0, object, @@ -2262,7 +2262,7 @@ TODO: implement { } -- (void)_setWindow:(id)window +- (void)_setWindow:(CPWindow)window { [super _setWindow:window]; } @@ -2426,7 +2426,7 @@ var CPRuleEditorAlignmentGridWidthKey = @"CPRuleEditorAlignmentGridWidth", return self; } -- (void)encodeWithCoder:(id)coder +- (void)encodeWithCoder:(CPCoder)coder { [super encodeWithCoder:coder]; @@ -2481,7 +2481,7 @@ var CriteriaKey = @"criteria", return "<" + [self className] + ">\nsubrows = " + [subrows description] + "\ncriteria = " + [criteria description] + "\ndisplayValues = " + [displayValues description]; } -- (id)initWithCoder:(id)coder +- (id)initWithCoder:(CPCoder)coder { self = [super init]; if (self !== nil) @@ -2495,7 +2495,7 @@ var CriteriaKey = @"criteria", return self; } -- (void)encodeWithCoder:(id)coder +- (void)encodeWithCoder:(CPCoder)coder { [coder encodeObject:subrows forKey:SubrowsKey]; [coder encodeObject:criteria forKey:CriteriaKey]; @@ -2534,7 +2534,7 @@ var CPBoundArrayKey = @"CPBoundArray"; return self; } -- (id)initWithCoder:(id)coder +- (id)initWithCoder:(CPCoder)coder { if (self = [super init]) boundArray = [coder decodeObjectForKey:CPBoundArrayKey]; @@ -2542,7 +2542,7 @@ var CPBoundArrayKey = @"CPBoundArray"; return self; } -- (void)encodeWithCoder:(id)coder +- (void)encodeWithCoder:(CPCoder)coder { [coder encodeObject:boundArray forKey:CPBoundArrayKey]; } diff --git a/AppKit/CPRuleEditor/_CPRuleEditorPopUpButton.j b/AppKit/CPRuleEditor/_CPRuleEditorPopUpButton.j index 3b48eff50..d70c6d6f3 100644 --- a/AppKit/CPRuleEditor/_CPRuleEditorPopUpButton.j +++ b/AppKit/CPRuleEditor/_CPRuleEditorPopUpButton.j @@ -86,7 +86,7 @@ else if (CPBrowserIsEngine(CPInternetExplorerBrowserEngine)) return self; } -- (id)hitTest:(CGPoint)point +- (CPView)hitTest:(CGPoint)point { if (!CGRectContainsPoint([self frame], point) || ![self sliceIsEditable]) return nil; @@ -100,12 +100,12 @@ else if (CPBrowserIsEngine(CPInternetExplorerBrowserEngine)) return ![superview isKindOfClass:[_CPRuleEditorViewSlice]] || [superview isEditable]; } -- (BOOL)trackMouse:(CPEvent)theEvent +- (void)trackMouse:(CPEvent)theEvent { if (![self sliceIsEditable]) - return NO; + return; - return [super trackMouse:theEvent]; + [super trackMouse:theEvent]; } - (CGRect)contentRectForBounds:(CGRect)bounds diff --git a/AppKit/CPRuleEditor/_CPRuleEditorViewSliceRow.j b/AppKit/CPRuleEditor/_CPRuleEditorViewSliceRow.j index bb00c8e21..20b573790 100644 --- a/AppKit/CPRuleEditor/_CPRuleEditorViewSliceRow.j +++ b/AppKit/CPRuleEditor/_CPRuleEditorViewSliceRow.j @@ -522,7 +522,7 @@ var CONTROL_HEIGHT = 16., return self; } -- (id)hitTest:(CGPoint)point +- (CPView)hitTest:(CGPoint)point { if (!CGRectContainsPoint([self frame], point)) return nil; diff --git a/AppKit/CPScroller.j b/AppKit/CPScroller.j index e0dcdc97c..6561af112 100644 --- a/AppKit/CPScroller.j +++ b/AppKit/CPScroller.j @@ -108,7 +108,7 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark"); return "scroller"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"scroller-width": 7.0, diff --git a/AppKit/CPSearchField.j b/AppKit/CPSearchField.j index 4fea175d5..d7346f9ed 100644 --- a/AppKit/CPSearchField.j +++ b/AppKit/CPSearchField.j @@ -458,7 +458,7 @@ var RECENT_SEARCH_PREFIX = @" "; [self sendAction:[self action] to:[self target]]; } -- (void)sendAction:(SEL)anAction to:(id)anObject +- (BOOL)sendAction:(SEL)anAction to:(id)anObject { [super sendAction:anAction to:anObject]; diff --git a/AppKit/CPSegmentedControl.j b/AppKit/CPSegmentedControl.j index 28f8bdc95..3bf94a0c2 100644 --- a/AppKit/CPSegmentedControl.j +++ b/AppKit/CPSegmentedControl.j @@ -56,7 +56,7 @@ CPSegmentSwitchTrackingMomentary = 2; return "segmented-control"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"alignment": CPCenterTextAlignment, diff --git a/AppKit/CPShadowView.j b/AppKit/CPShadowView.j index 942477ecf..5fcc5c26c 100644 --- a/AppKit/CPShadowView.j +++ b/AppKit/CPShadowView.j @@ -47,7 +47,7 @@ CPThemeStateShadowViewHeavy = CPThemeState("shadowview-style-heavy"); return "shadow-view"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"bezel-color": [CPNull null], diff --git a/AppKit/CPSlider.j b/AppKit/CPSlider.j index b9b7e92da..2190118d2 100644 --- a/AppKit/CPSlider.j +++ b/AppKit/CPSlider.j @@ -49,7 +49,7 @@ CPCircularSlider = 1; return "slider"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"knob-color": [CPNull null], diff --git a/AppKit/CPSplitView.j b/AppKit/CPSplitView.j index 7e62a4d5d..15201a59a 100644 --- a/AppKit/CPSplitView.j +++ b/AppKit/CPSplitView.j @@ -103,7 +103,7 @@ var ShouldSuppressResizeNotifications = 1, return @"splitview"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"divider-thickness": 1.0, @@ -995,7 +995,7 @@ The sum of the views and the sum of the dividers should be equal to the size of @param unsigned int - The divider index the button bar will be assigned to. */ // FIXME Should be renamed to setButtonBar:ofDividerAtIndex:. -- (void)setButtonBar:(CPButtonBar)aButtonBar forDividerAtIndex:(unsigned)dividerIndex +- (void)setButtonBar:(CPButtonBar)aButtonBar forDividerAtIndex:(CPUInteger)dividerIndex { if (!aButtonBar) { diff --git a/AppKit/CPStepper.j b/AppKit/CPStepper.j index 0e7fc7586..ba5da1462 100644 --- a/AppKit/CPStepper.j +++ b/AppKit/CPStepper.j @@ -213,7 +213,7 @@ Set the current value of the stepper. @param aValue a float containing the value */ -- (void)setDoubleValue:(float)aValue +- (void)setDoubleValue:(double)aValue { if (aValue > _maxValue) [super setDoubleValue:_valueWraps ? _minValue : _maxValue]; @@ -267,7 +267,7 @@ return @"stepper"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"bezel-color-up-button": [CPNull null], diff --git a/AppKit/CPTabView.j b/AppKit/CPTabView.j index b6874a01b..06f216b8c 100644 --- a/AppKit/CPTabView.j +++ b/AppKit/CPTabView.j @@ -107,7 +107,7 @@ var CPTabViewDidSelectTabViewItemSelector = 1, @param aTabViewItem the item to insert @param anIndex the index for the item */ -- (void)insertTabViewItem:(CPTabViewItem)aTabViewItem atIndex:(unsigned)anIndex +- (void)insertTabViewItem:(CPTabViewItem)aTabViewItem atIndex:(CPUInteger)anIndex { [_items insertObject:aTabViewItem atIndex:anIndex]; @@ -183,7 +183,7 @@ var CPTabViewDidSelectTabViewItemSelector = 1, Returns the CPTabViewItem at the specified index. @return a tab view item, or nil */ -- (CPTabViewItem)tabViewItemAtIndex:(unsigned)anIndex +- (CPTabViewItem)tabViewItemAtIndex:(CPUInteger)anIndex { return [_items objectAtIndex:anIndex]; } @@ -270,7 +270,7 @@ var CPTabViewDidSelectTabViewItemSelector = 1, Selects the item at the specified index. @param anIndex the index of the item to display. */ -- (BOOL)selectTabViewItemAtIndex:(unsigned)anIndex +- (BOOL)selectTabViewItemAtIndex:(CPUInteger)anIndex { if (anIndex === _selectedIndex) return; diff --git a/AppKit/CPTableColumn.j b/AppKit/CPTableColumn.j index 823fdc73a..01c156b90 100644 --- a/AppKit/CPTableColumn.j +++ b/AppKit/CPTableColumn.j @@ -595,7 +595,7 @@ CPTableColumnUserResizingMask = 1 << 1; @implementation CPTableColumn (Bindings) -+ (id)_binderClassForBinding:(CPString)aBinding ++ (Class)_binderClassForBinding:(CPString)aBinding { if (aBinding == CPValueBinding) return [CPTableColumnValueBinder class]; diff --git a/AppKit/CPTableHeaderView.j b/AppKit/CPTableHeaderView.j index c98fab98b..9db2b6c06 100644 --- a/AppKit/CPTableHeaderView.j +++ b/AppKit/CPTableHeaderView.j @@ -43,7 +43,7 @@ return @"columnHeader"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"background-color": [CPNull null], @@ -57,7 +57,7 @@ }; } -- (void)initWithFrame:(CGRect)frame +- (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; @@ -246,7 +246,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal return @"tableHeaderRow"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"background-color": [CPNull null], diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index e6e4928db..ebb0fefca 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -286,7 +286,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; /*! @ignore */ -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"alternating-row-colors": [CPNull null], @@ -5142,7 +5142,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad /*! @ignore */ -- (id)hitTest:(CGPoint)aPoint +- (CPView)hitTest:(CGPoint)aPoint { var hit = [super hitTest:aPoint]; @@ -5368,7 +5368,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @implementation CPTableView (Bindings) -+ (id)_binderClassForBinding:(CPString)aBinding ++ (Class)_binderClassForBinding:(CPString)aBinding { if (aBinding == @"content") return [CPTableContentBinder class]; @@ -5425,7 +5425,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad id _content @accessors(property=content); } -- (void)setValueFor:(id)aBinding +- (void)setValueFor:(CPString)aBinding { var destination = [_info objectForKey:CPObservedObjectKey], keyPath = [_info objectForKey:CPObservedKeyPathKey]; @@ -5738,13 +5738,13 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey", [self setThemeState:CPThemeStateTableDataView]; } -- (void)setThemeState:(CPThemeState)aState +- (BOOL)setThemeState:(CPThemeState)aState { [super setThemeState:aState]; [self recursivelyPerformSelector:@selector(setThemeState:) withObject:aState startingFrom:self]; } -- (void)unsetThemeState:(CPThemeState)aState +- (BOOL)unsetThemeState:(CPThemeState)aState { [super unsetThemeState:aState]; [self recursivelyPerformSelector:@selector(unsetThemeState:) withObject:aState startingFrom:self]; diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j index 3e8a48739..3bf585ec9 100644 --- a/AppKit/CPTextField.j +++ b/AppKit/CPTextField.j @@ -209,7 +209,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); return "textfield"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"bezel-inset": CGInsetMakeZero(), @@ -1719,7 +1719,7 @@ var CPTextFieldIsEditableKey = "CPTextFieldIsEditableKey", @implementation _CPTextFieldValueBinder : CPBinder -- (void)_updatePlaceholdersWithOptions:(CPDictionary)options forBinding:(CPBinder)aBinding +- (void)_updatePlaceholdersWithOptions:(CPDictionary)options forBinding:(CPString)aBinding { [super _updatePlaceholdersWithOptions:options]; diff --git a/AppKit/CPTokenField.j b/AppKit/CPTokenField.j index 004459a65..40a76526d 100644 --- a/AppKit/CPTokenField.j +++ b/AppKit/CPTokenField.j @@ -98,7 +98,7 @@ CPTokenFieldDeleteButtonType = 1; return "tokenfield"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"editor-inset": CGInsetMakeZero() }; } @@ -645,7 +645,7 @@ CPTokenFieldDeleteButtonType = 1; [[self _tokens] makeObjectsPerformSelector:@selector(setEditable:) withObject:shouldBeEditable]; } -- (void)sendAction:(SEL)anAction to:(id)anObject +- (BOOL)sendAction:(SEL)anAction to:(id)anObject { _shouldNotifyTarget = NO; [super sendAction:anAction to:anObject]; @@ -653,7 +653,7 @@ CPTokenFieldDeleteButtonType = 1; // Incredible hack to disable supers implementation // so it cannot change our object value and break the tokenfield -- (void)_setStringValue:(id)aValue +- (BOOL)_setStringValue:(CPString)aValue { } @@ -1541,7 +1541,7 @@ CPTokenFieldDeleteButtonType = 1; { } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { var attributes = [CPButton themeAttributes]; @@ -1571,7 +1571,7 @@ CPTokenFieldDeleteButtonType = 1; { } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { var attributes = [CPButton themeAttributes]; diff --git a/AppKit/CPToolbar.j b/AppKit/CPToolbar.j index ae1857926..86ee9d721 100644 --- a/AppKit/CPToolbar.j +++ b/AppKit/CPToolbar.j @@ -594,7 +594,7 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth) return @"toolbar-view"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"item-margin": 10.0, @@ -1216,7 +1216,7 @@ var LABEL_MARGIN = 2.0; [_labelField setTextShadowColor:[self FIXME_labelShadowColor]]; } -- (void)sendAction:(SEL)anAction to:(id)aSender +- (BOOL)sendAction:(SEL)anAction to:(id)aSender { [CPApp sendAction:anAction to:aSender from:_toolbarItem]; } diff --git a/AppKit/CPViewAnimation.j b/AppKit/CPViewAnimation.j index 85f76e2a2..f90ca2f99 100644 --- a/AppKit/CPViewAnimation.j +++ b/AppKit/CPViewAnimation.j @@ -105,7 +105,7 @@ CPViewAnimationFadeOutEffect = @"CPViewAnimationFadeOutEffect"; [super startAnimation]; } -- (void)setCurrentProgress:(CPAnimationProgress)progress +- (void)setCurrentProgress:(float)progress { [super setCurrentProgress:progress]; diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index 51abbf76a..40713f70f 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -248,7 +248,7 @@ CPTexturedBackgroundWindowMask @param aStyleMask a style mask @return the initialized window */ -- (id)initWithContentRect:(CGRect)aContentRect styleMask:(unsigned int)aStyleMask +- (id)initWithContentRect:(CGRect)aContentRect styleMask:(unsigned)aStyleMask { self = [super init]; diff --git a/AppKit/CPWindow/_CPBorderlessBridgeWindowView.j b/AppKit/CPWindow/_CPBorderlessBridgeWindowView.j index b726343bb..26fe1fe6f 100644 --- a/AppKit/CPWindow/_CPBorderlessBridgeWindowView.j +++ b/AppKit/CPWindow/_CPBorderlessBridgeWindowView.j @@ -32,7 +32,7 @@ return @"bordeless-bridge-window-view"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"toolbar-background-color": [CPColor grayColor], diff --git a/AppKit/CPWindow/_CPDocModalWindowView.j b/AppKit/CPWindow/_CPDocModalWindowView.j index 775b9542d..c1219c22c 100644 --- a/AppKit/CPWindow/_CPDocModalWindowView.j +++ b/AppKit/CPWindow/_CPDocModalWindowView.j @@ -33,7 +33,7 @@ return @"doc-modal-window-view"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"body-color": [CPColor whiteColor], diff --git a/AppKit/CPWindow/_CPPopoverWindowView.j b/AppKit/CPWindow/_CPPopoverWindowView.j index 554f362e2..b337be625 100644 --- a/AppKit/CPWindow/_CPPopoverWindowView.j +++ b/AppKit/CPWindow/_CPPopoverWindowView.j @@ -50,7 +50,7 @@ var _CPPopoverWindowViewDefaultCursorSize = CGSizeMake(16, 10); return @"popover-window-view"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"background-gradient": [CPNull null], diff --git a/AppKit/CPWindow/_CPShadowWindowView.j b/AppKit/CPWindow/_CPShadowWindowView.j index d7095a750..cd0cec03c 100644 --- a/AppKit/CPWindow/_CPShadowWindowView.j +++ b/AppKit/CPWindow/_CPShadowWindowView.j @@ -41,7 +41,7 @@ return @"shadow-window-view"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{}; } diff --git a/AppKit/CPWindow/_CPStandardWindowView.j b/AppKit/CPWindow/_CPStandardWindowView.j index b7aedf1ce..d8ea56ceb 100644 --- a/AppKit/CPWindow/_CPStandardWindowView.j +++ b/AppKit/CPWindow/_CPStandardWindowView.j @@ -41,7 +41,7 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; return @"textured-window-head-view"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{}; } @@ -108,7 +108,7 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; return @"standard-window-view"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"gradient-height": [CPNull null], diff --git a/AppKit/CPWindow/_CPToolTipWindowView.j b/AppKit/CPWindow/_CPToolTipWindowView.j index 423725fb7..b06c77863 100644 --- a/AppKit/CPWindow/_CPToolTipWindowView.j +++ b/AppKit/CPWindow/_CPToolTipWindowView.j @@ -38,7 +38,7 @@ return @"tooltip"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"stroke-color": [CPColor colorWithHexString:@"E3E3E3"], diff --git a/AppKit/CPWindow/_CPWindowView.j b/AppKit/CPWindow/_CPWindowView.j index c874ec409..0ffd01121 100644 --- a/AppKit/CPWindow/_CPWindowView.j +++ b/AppKit/CPWindow/_CPWindowView.j @@ -81,7 +81,7 @@ _CPWindowViewResizeSlop = 3; return "window"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"title-bar-height": 25, diff --git a/AppKit/CoreAnimation/CALayer.j b/AppKit/CoreAnimation/CALayer.j index 066ff8437..dbe2c3dee 100644 --- a/AppKit/CoreAnimation/CALayer.j +++ b/AppKit/CoreAnimation/CALayer.j @@ -687,7 +687,7 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex) @param aLayer the layer to insert @param anIndex the index to insert the layer at */ -- (void)insertSublayer:(CALayer)aLayer atIndex:(unsigned)anIndex +- (void)insertSublayer:(CALayer)aLayer atIndex:(CPUInteger)anIndex { if (!aLayer) return; diff --git a/AppKit/CoreAnimation/CAMediaTimingFunction.j b/AppKit/CoreAnimation/CAMediaTimingFunction.j index 77d953921..a80306b42 100644 --- a/AppKit/CoreAnimation/CAMediaTimingFunction.j +++ b/AppKit/CoreAnimation/CAMediaTimingFunction.j @@ -75,7 +75,7 @@ var CAMediaNamedTimingFunctions = nil; return self; } -- (void)getControlPointAtIndex:(unsigned)anIndex values:(float/*[2]*/)reference +- (void)getControlPointAtIndex:(CPUInteger)anIndex values:(float/*[2]*/)reference { if (anIndex == 0) { diff --git a/AppKit/Platform/DOM/CPDOMWindowLayer.j b/AppKit/Platform/DOM/CPDOMWindowLayer.j index 5ef90849d..144b8f84a 100644 --- a/AppKit/Platform/DOM/CPDOMWindowLayer.j +++ b/AppKit/Platform/DOM/CPDOMWindowLayer.j @@ -78,7 +78,7 @@ aWindow._isVisible = NO; } -- (void)insertWindow:(CPWindow)aWindow atIndex:(unsigned)anIndex +- (void)insertWindow:(CPWindow)aWindow atIndex:(CPUInteger)anIndex { // We will have to adjust the z-index of all windows starting at this index. var count = [_windows count], diff --git a/AppKit/_CPAutocompleteMenu.j b/AppKit/_CPAutocompleteMenu.j index 2d2d2f01a..5947ead97 100644 --- a/AppKit/_CPAutocompleteMenu.j +++ b/AppKit/_CPAutocompleteMenu.j @@ -280,7 +280,7 @@ var _CPAutocompleteMenuMaximumHeight = 307; @implementation _CPAutocompleteWindow : CPPanel -- (id)initWithContentRect:(CGRect)aContentRect styleMask:(unsigned int)aStyleMask +- (id)initWithContentRect:(CGRect)aContentRect styleMask:(unsigned)aStyleMask { if (self = [super initWithContentRect:aContentRect styleMask:aStyleMask]) _constrainsToUsableScreen = NO; diff --git a/AppKit/_CPCornerView.j b/AppKit/_CPCornerView.j index 02371b3c5..8f777f1bb 100644 --- a/AppKit/_CPCornerView.j +++ b/AppKit/_CPCornerView.j @@ -31,7 +31,7 @@ return @"cornerview"; } -+ (id)themeAttributes ++ (CPDictionary)themeAttributes { return @{ @"background-color": [CPNull null], diff --git a/AppKit/_CPImageAndTextView.j b/AppKit/_CPImageAndTextView.j index c5582c129..892bd20f2 100644 --- a/AppKit/_CPImageAndTextView.j +++ b/AppKit/_CPImageAndTextView.j @@ -218,7 +218,7 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0, [self setNeedsLayout]; } -- (void)imageScaling +- (CPUInteger)imageScaling { return _imageScaling; } diff --git a/AppKit/_CPPopUpList.j b/AppKit/_CPPopUpList.j index dc8a74227..d17684e4b 100644 --- a/AppKit/_CPPopUpList.j +++ b/AppKit/_CPPopUpList.j @@ -853,7 +853,7 @@ var _CPPopUpListDataSourceKey = @"_CPPopUpListDataSourceKey", @implementation _CPPopUpPanel : CPPanel -- (id)initWithContentRect:(CGRect)aContentRect styleMask:(unsigned int)aStyleMask +- (id)initWithContentRect:(CGRect)aContentRect styleMask:(unsigned)aStyleMask { if (self = [super initWithContentRect:aContentRect styleMask:aStyleMask]) _constrainsToUsableScreen = NO; diff --git a/AppKit/_CPPopoverWindow.j b/AppKit/_CPPopoverWindow.j index 8e24bdee0..2f7f5b4e4 100644 --- a/AppKit/_CPPopoverWindow.j +++ b/AppKit/_CPPopoverWindow.j @@ -399,7 +399,7 @@ var _CPPopoverWindow_shouldClose_ = 1 << 0, @param sender the sender of the action */ -- (IBAction)orderFront:(is)aSender +- (IBAction)orderFront:(id)aSender { if (![self isKeyWindow]) { diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1bde4969b..b32c82d6e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -598,7 +598,7 @@ Use descriptive parameter types, despite not being fully supported in JavaScript ##### Right: - - (char)characterAtIndex:(unsigned)anIndex; + - (char)characterAtIndex:(CPUInteger)anIndex; - (void)insertObject:(id)anObject; ##### Wrong: diff --git a/Foundation/CPArray+KVO.j b/Foundation/CPArray+KVO.j index 18a71a031..33fc4791f 100644 --- a/Foundation/CPArray+KVO.j +++ b/Foundation/CPArray+KVO.j @@ -197,7 +197,7 @@ [_proxyObject setValue:anObject forKey:_key]; } -- (unsigned)count +- (CPUInteger)count { if (_count) return _count(_proxyObject, _countSEL); @@ -205,7 +205,7 @@ return [[self _representedObject] count]; } -- (int)indexOfObject:(CPObject)anObject inRange:(CPRange)aRange +- (CPUInteger)indexOfObject:(id)anObject inRange:(CPRange)aRange { var index = aRange.location, count = aRange.length, @@ -222,12 +222,12 @@ return CPNotFound; } -- (int)indexOfObject:(CPObject)anObject +- (CPUInteger)indexOfObject:(id)anObject { return [self indexOfObject:anObject inRange:CPMakeRange(0, [self count])]; } -- (int)indexOfObjectIdenticalTo:(CPObject)anObject inRange:(CPRange)aRange +- (CPUInteger)indexOfObjectIdenticalTo:(id)anObject inRange:(CPRange)aRange { var index = aRange.location, count = aRange.length; @@ -239,12 +239,12 @@ return CPNotFound; } -- (int)indexOfObjectIdenticalTo:(CPObject)anObject +- (CPUInteger)indexOfObjectIdenticalTo:(id)anObject { return [self indexOfObjectIdenticalTo:anObject inRange:CPMakeRange(0, [self count])]; } -- (id)objectAtIndex:(unsigned)anIndex +- (id)objectAtIndex:(CPUInteger)anIndex { return [[self objectsAtIndexes:[CPIndexSet indexSetWithIndex:anIndex]] firstObject]; } @@ -281,7 +281,7 @@ [self insertObjects:anArray atIndexes:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange([self count], count)]]; } -- (void)insertObject:(id)anObject atIndex:(unsigned)anIndex +- (void)insertObject:(id)anObject atIndex:(CPUInteger)anIndex { [self insertObjects:[anObject] atIndexes:[CPIndexSet indexSetWithIndex:anIndex]]; } @@ -378,7 +378,7 @@ [self removeObjectsAtIndexes:[CPIndexSet indexSetWithIndex:[self count] - 1]]; } -- (void)removeObjectAtIndex:(unsigned)anIndex +- (void)removeObjectAtIndex:(CPUInteger)anIndex { [self removeObjectsAtIndexes:[CPIndexSet indexSetWithIndex:anIndex]]; } @@ -405,7 +405,7 @@ } } -- (void)replaceObjectAtIndex:(unsigned)anIndex withObject:(id)anObject +- (void)replaceObjectAtIndex:(CPUInteger)anIndex withObject:(id)anObject { [self replaceObjectsAtIndexes:[CPIndexSet indexSetWithIndex:anIndex] withObjects:[anObject]] } @@ -564,7 +564,7 @@ /*! Registers an observer to receive key value observer notifications for the specified key-path relative to the objects at the indexes. */ -- (void)addObserver:(id)anObserver toObjectsAtIndexes:(CPIndexSet)indexes forKeyPath:(CPString)aKeyPath options:(unsigned)options context:(id)context +- (void)addObserver:(id)anObserver toObjectsAtIndexes:(CPIndexSet)indexes forKeyPath:(CPString)aKeyPath options:(CPKeyValueObservingOptions)options context:(id)context { var index = [indexes firstIndex]; diff --git a/Foundation/CPArray/CPMutableArray.j b/Foundation/CPArray/CPMutableArray.j index e15ccb138..ec4a7769c 100644 --- a/Foundation/CPArray/CPMutableArray.j +++ b/Foundation/CPArray/CPMutableArray.j @@ -21,7 +21,7 @@ items. Because CPArray is backed by JavaScript arrays, this method ends up simply returning a regular array. */ -+ (CPArray)arrayWithCapacity:(unsigned)aCapacity ++ (CPArray)arrayWithCapacity:(CPUInteger)aCapacity { return [[self alloc] initWithCapacity:aCapacity]; } @@ -30,7 +30,7 @@ Initializes an array able to store at least \c aCapacity items. Because CPArray is backed by JavaScript arrays, this method ends up simply returning a regular array. */ -/*- (id)initWithCapacity:(unsigned)aCapacity +/*- (id)initWithCapacity:(CPUInteger)aCapacity { return self; }*/ @@ -63,7 +63,7 @@ @param anObject the object to insert into the array @param anIndex the location to insert \c anObject at */ -- (void)insertObject:(id)anObject atIndex:(int)anIndex +- (void)insertObject:(id)anObject atIndex:(CPUInteger)anIndex { _CPRaiseInvalidAbstractInvocation(self, _cmd); } @@ -93,7 +93,7 @@ [self insertObject:[objects objectAtIndex:index] atIndex:currentIndex]; } -- (unsigned)insertObject:(id)anObject inArraySortedByDescriptors:(CPArray)descriptors +- (CPUInteger)insertObject:(id)anObject inArraySortedByDescriptors:(CPArray)descriptors { var index, count = [descriptors count]; @@ -126,7 +126,7 @@ The current element at position \c anIndex will be removed from the array. @param anIndex the position in the array to place \c anObject */ -- (void)replaceObjectAtIndex:(int)anIndex withObject:(id)anObject +- (void)replaceObjectAtIndex:(CPUInteger)anIndex withObject:(id)anObject { _CPRaiseInvalidAbstractInvocation(self, _cmd); } @@ -241,7 +241,7 @@ Removes the object at \c anIndex. @param anIndex the location of the element to be removed */ -- (void)removeObjectAtIndex:(int)anIndex +- (void)removeObjectAtIndex:(CPUInteger)anIndex { _CPRaiseInvalidAbstractInvocation(self, _cmd); } @@ -322,7 +322,7 @@ @param anIndex the first index to swap from @param otherIndex the second index to swap from */ -- (void)exchangeObjectAtIndex:(unsigned)anIndex withObjectAtIndex:(unsigned)otherIndex +- (void)exchangeObjectAtIndex:(CPUInteger)anIndex withObjectAtIndex:(CPUInteger)otherIndex { if (anIndex === otherIndex) return; diff --git a/Foundation/CPArray/_CPArray.j b/Foundation/CPArray/_CPArray.j index 5ecb8a6cb..093023904 100755 --- a/Foundation/CPArray/_CPArray.j +++ b/Foundation/CPArray/_CPArray.j @@ -122,7 +122,7 @@ var concat = Array.prototype.concat, @param aCount the number of objects in the JS Array @return a new CPArray containing the specified objects */ -+ (id)arrayWithObjects:(id)objects count:(unsigned)aCount ++ (id)arrayWithObjects:(id)objects count:(CPUInteger)aCount { return [[self alloc] initWithObjects:objects count:aCount]; } @@ -174,13 +174,13 @@ var concat = Array.prototype.concat, @param aCount the number of objects in \c objects @return the initialized CPArray */ -- (id)initWithObjects:(id)objects count:(unsigned)aCount +- (id)initWithObjects:(CPArray)objects count:(CPUInteger)aCount { FORWARD_TO_CONCRETE_CLASS(); } // FIXME: This should be defined in CPMutableArray, not here. -- (id)initWithCapacity:(unsigned)aCapacity +- (id)initWithCapacity:(CPUInteger)aCapacity { FORWARD_TO_CONCRETE_CLASS(); } @@ -203,7 +203,7 @@ var concat = Array.prototype.concat, /*! Returns the number of elements in the array */ -- (int)count +- (CPUInteger)count { _CPRaiseInvalidAbstractInvocation(self, _cmd); } @@ -238,7 +238,7 @@ var concat = Array.prototype.concat, Returns the object at index \c anIndex. @throws CPRangeException if \c anIndex is out of bounds */ -- (id)objectAtIndex:(int)anIndex +- (id)objectAtIndex:(CPUInteger)anIndex { _CPRaiseInvalidAbstractInvocation(self, _cmd); } diff --git a/Foundation/CPArray/_CPJavaScriptArray.j b/Foundation/CPArray/_CPJavaScriptArray.j index b11c78767..c3765ad2e 100644 --- a/Foundation/CPArray/_CPJavaScriptArray.j +++ b/Foundation/CPArray/_CPJavaScriptArray.j @@ -19,7 +19,7 @@ var concat = Array.prototype.concat, return []; } -+ (CPArray)array ++ (id)array { return []; } @@ -107,7 +107,7 @@ var concat = Array.prototype.concat, return self; } -- (BOOL)count +- (CPUInteger)count { return self.length; } @@ -230,7 +230,7 @@ var concat = Array.prototype.concat, return join.call(self, aString); } -- (void)insertObject:(id)anObject atIndex:(int)anIndex +- (void)insertObject:(id)anObject atIndex:(CPUInteger)anIndex { if (anIndex > self.length || anIndex < 0) _CPRaiseRangeException(self, _cmd, anIndex, self.length); @@ -238,7 +238,7 @@ var concat = Array.prototype.concat, splice.call(self, anIndex, 0, anObject); } -- (void)removeObjectAtIndex:(int)anIndex +- (void)removeObjectAtIndex:(CPUInteger)anIndex { if (anIndex >= self.length || anIndex < 0) _CPRaiseRangeException(self, _cmd, anIndex, self.length); @@ -289,7 +289,7 @@ var concat = Array.prototype.concat, splice.call(self, aRange.location, aRange.length); } -- (void)replaceObjectAtIndex:(int)anIndex withObject:(id)anObject +- (void)replaceObjectAtIndex:(CPUInteger)anIndex withObject:(id)anObject { if (anIndex >= self.length || anIndex < 0) _CPRaiseRangeException(self, _cmd, anIndex, self.length); @@ -333,7 +333,7 @@ var concat = Array.prototype.concat, } -- (void)copy +- (id)copy { return slice.call(self, 0); } diff --git a/Foundation/CPAttributedString.j b/Foundation/CPAttributedString.j index 337ccc722..beee46e8d 100644 --- a/Foundation/CPAttributedString.j +++ b/Foundation/CPAttributedString.j @@ -179,7 +179,7 @@ character at index \c anIndex. Returns an empty dictionary if index is out of bounds. */ -- (CPDictionary)attributesAtIndex:(unsigned)anIndex effectiveRange:(CPRangePointer)aRange +- (CPDictionary)attributesAtIndex:(CPUInteger)anIndex effectiveRange:(CPRangePointer)aRange { // find the range entry that contains anIndex. var entryIndex = [self _indexOfEntryWithIndex:anIndex]; @@ -219,7 +219,7 @@ character at index \c anIndex. Returns an empty dictionary if index is out of bounds. */ -- (CPDictionary)attributesAtIndex:(unsigned)anIndex longestEffectiveRange:(CPRangePointer)aRange inRange:(CPRange)rangeLimit +- (CPDictionary)attributesAtIndex:(CPUInteger)anIndex longestEffectiveRange:(CPRangePointer)aRange inRange:(CPRange)rangeLimit { var startingEntryIndex = [self _indexOfEntryWithIndex:anIndex]; @@ -295,7 +295,7 @@ @return the named attribute or \c nil is the attribute does not exist. */ -- (id)attribute:(CPString)attribute atIndex:(unsigned)index effectiveRange:(CPRangePointer)aRange +- (id)attribute:(CPString)attribute atIndex:(CPUInteger)index effectiveRange:(CPRangePointer)aRange { if (!attribute) { @@ -332,7 +332,7 @@ @return the named attribute or \c nil is the attribute does not exist. */ -- (id)attribute:(CPString)attribute atIndex:(unsigned)anIndex longestEffectiveRange:(CPRangePointer)aRange inRange:(CPRange)rangeLimit +- (id)attribute:(CPString)attribute atIndex:(CPUInteger)anIndex longestEffectiveRange:(CPRangePointer)aRange inRange:(CPRange)rangeLimit { var startingEntryIndex = [self _indexOfEntryWithIndex:anIndex]; @@ -690,7 +690,7 @@ @param anIndex the index at which the insert is to occur. @exception CPRangeException If the index is out of bounds. */ -- (void)insertAttributedString:(CPAttributedString)aString atIndex:(unsigned)anIndex +- (void)insertAttributedString:(CPAttributedString)aString atIndex:(CPUInteger)anIndex { if (anIndex < 0 || anIndex > [self length]) [CPException raise:CPRangeException reason:"tried to insert attributed string at an invalid index: "+anIndex]; diff --git a/Foundation/CPByteCountFormatter.j b/Foundation/CPByteCountFormatter.j index 0d04b4c34..c04baaa8d 100644 --- a/Foundation/CPByteCountFormatter.j +++ b/Foundation/CPByteCountFormatter.j @@ -214,7 +214,7 @@ var CPByteCountFormatterUnits = [ @"bytes", @"KB", @"MB", @"GB", @"TB", @"PB" ]; return nil; } -- (BOOL)getObjectValue:(id)anObject forString:(CPString)aString errorDescription:(CPString)anError +- (BOOL)getObjectValue:(idRef)anObject forString:(CPString)aString errorDescription:(CPStringRef)anError { // Not implemented return NO; diff --git a/Foundation/CPDateFormatter.j b/Foundation/CPDateFormatter.j index aa5138786..3743e62b3 100644 --- a/Foundation/CPDateFormatter.j +++ b/Foundation/CPDateFormatter.j @@ -1201,7 +1201,7 @@ var defaultDateFormatterBehavior = CPDateFormatterBehavior10_4, @param anError, if it returns NO the describe error will be in anError (use of ref) @return aBoolean for the success or fail of the method */ -- (BOOL)getObjectValue:(id)anObject forString:(CPString)aString errorDescription:(CPString)anError +- (BOOL)getObjectValue:(idRef)anObject forString:(CPString)aString errorDescription:(CPStringRef)anError { var value = [self dateFromString:aString]; @deref(anObject) = value; diff --git a/Foundation/CPDecimalNumber.j b/Foundation/CPDecimalNumber.j index c7b78d218..7221cd2e5 100644 --- a/Foundation/CPDecimalNumber.j +++ b/Foundation/CPDecimalNumber.j @@ -130,7 +130,20 @@ var CPDefaultDcmHandler = nil; @end // CPDecimalNumberBehaviors protocol -@implementation CPDecimalNumberHandler (CPDecimalNumberBehaviors) + +@protocol CPDecimalNumberBehaviors + +- (CPRoundingMode)roundingMode; + +- (short)scale; + // The scale could return NO_SCALE for no defined scale. + +- (CPDecimalNumber)exceptionDuringOperation:(SEL)operation error:(CPCalculationError)error leftOperand:(CPDecimalNumber)leftOperand rightOperand:(CPDecimalNumber)rightOperand; + // Receiver can raise, return a new value, or return nil to ignore the exception. + +@end + +@implementation CPDecimalNumberHandler (CPDecimalNumberBehaviors) /*! Returns the current rounding mode. One of \e CPRoundingMode enum: diff --git a/Foundation/CPError.j b/Foundation/CPError.j index 34a53bee5..4acafe2ce 100644 --- a/Foundation/CPError.j +++ b/Foundation/CPError.j @@ -91,7 +91,7 @@ CPFilePathErrorKey = @"CPFilePathErrorKey"; return [_userInfo objectForKey:CPRecoveryAttempterErrorKey]; } -- (id)description +- (CPString)description { return [CPString stringWithFormat:@"Error Domain=%@ Code=%d UserInfo=%p %@", _domain, _code, _userInfo, [self localizedDescription]]; } diff --git a/Foundation/CPIndexSet.j b/Foundation/CPIndexSet.j index b2a362300..c9f94fddb 100644 --- a/Foundation/CPIndexSet.j +++ b/Foundation/CPIndexSet.j @@ -1187,5 +1187,5 @@ X - (void)addIndex:(unsigned int)value; X - (void)removeIndex:(unsigned int)value; X - (void)addIndexesInRange:(NSRange)range; X - (void)removeIndexesInRange:(NSRange)range; - - (void)shiftIndexesStartingAtIndex:(unsigned int)index by:(int)delta; + - (void)shiftIndexesStartingAtIndex:(CPUInteger)index by:(int)delta; */ diff --git a/Foundation/CPInvocation.j b/Foundation/CPInvocation.j index 7cc5fbe32..a07b48952 100644 --- a/Foundation/CPInvocation.j +++ b/Foundation/CPInvocation.j @@ -105,7 +105,7 @@ @param anArgument the argument to add @param anIndex the index of the argument in the method */ -- (void)setArgument:(id)anArgument atIndex:(unsigned)anIndex +- (void)setArgument:(id)anArgument atIndex:(CPUInteger)anIndex { _arguments[anIndex] = anArgument; } @@ -116,7 +116,7 @@ @param anIndex the index of the argument to return @throws CPInvalidArgumentException if anIndex is greater than or equal to the invocation's number of arguments. */ -- (id)argumentAtIndex:(unsigned)anIndex +- (id)argumentAtIndex:(CPUInteger)anIndex { return _arguments[anIndex]; } diff --git a/Foundation/CPKeyValueObserving.j b/Foundation/CPKeyValueObserving.j index 308cb0f6e..5dc1257a0 100644 --- a/Foundation/CPKeyValueObserving.j +++ b/Foundation/CPKeyValueObserving.j @@ -135,7 +135,7 @@ } } -- (void)addObserver:(id)anObserver forKeyPath:(CPString)aPath options:(unsigned)options context:(id)aContext +- (void)addObserver:(id)anObserver forKeyPath:(CPString)aPath options:(CPKeyValueObservingOptions)options context:(id)aContext { if (!anObserver || !aPath) return; @@ -742,7 +742,7 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOpti } } -- (void)_addObserver:(id)anObserver forKeyPath:(CPString)aPath options:(unsigned)options context:(id)aContext +- (void)_addObserver:(id)anObserver forKeyPath:(CPString)aPath options:(CPKeyValueObservingOptions)options context:(id)aContext { if (!anObserver) return; diff --git a/Foundation/CPNumberFormatter.j b/Foundation/CPNumberFormatter.j index 8b485ef13..4057aedce 100644 --- a/Foundation/CPNumberFormatter.j +++ b/Foundation/CPNumberFormatter.j @@ -189,7 +189,7 @@ var NumberRegex = new RegExp('(-)?(\\d*)(\\.(\\d*))?'); return [self stringForObjectValue:anObject]; } -- (BOOL)getObjectValue:(id)anObjectRef forString:(CPString)aString errorDescription:(CPString)anErrorRef +- (BOOL)getObjectValue:(idRef)anObjectRef forString:(CPString)aString errorDescription:(CPStringRef)anErrorRef { // Interpret an empty string as nil, like in Cocoa. if (aString === @"") diff --git a/Foundation/CPScanner.j b/Foundation/CPScanner.j index ea2ffb3dc..f4c01c9df 100644 --- a/Foundation/CPScanner.j +++ b/Foundation/CPScanner.j @@ -329,7 +329,7 @@ /* = Debug = */ /* ========= */ -- (void)description +- (CPString)description { return [super description] + " {" + CPStringFromClass([self class]) + ", state = '" + ([self string].substr(0, _scanLocation) + "{{ SCAN LOCATION ->}}" + [self string].substr(_scanLocation)) + "'; }"; } diff --git a/Foundation/CPSet+KVO.j b/Foundation/CPSet+KVO.j index 2bc3560d0..d4648fe10 100644 --- a/Foundation/CPSet+KVO.j +++ b/Foundation/CPSet+KVO.j @@ -168,7 +168,7 @@ [_proxyObject setValue:anObject forKey:_key]; } -- (unsigned)count +- (CPUInteger)count { if (_count) return _count(_proxyObject, _countSEL); diff --git a/Foundation/CPString.j b/Foundation/CPString.j index b5e076a2d..d9992ed8f 100644 --- a/Foundation/CPString.j +++ b/Foundation/CPString.j @@ -206,7 +206,7 @@ var CPStringUIDs = new CFMutableDictionary(), Returns the character at the specified index. @param anIndex the index of the desired character */ -- (CPString)characterAtIndex:(unsigned)anIndex +- (CPString)characterAtIndex:(CPUInteger)anIndex { return self.charAt(anIndex); } @@ -249,7 +249,7 @@ var CPStringUIDs = new CFMutableDictionary(), @param anIndex the index of the padding string to start from (if necessary to use) @return the new padded string */ -- (CPString)stringByPaddingToLength:(unsigned)aLength withString:(CPString)aString startingAtIndex:(unsigned)anIndex +- (CPString)stringByPaddingToLength:(unsigned)aLength withString:(CPString)aString startingAtIndex:(CPUInteger)anIndex { if (self.length == aLength) return self; @@ -596,7 +596,7 @@ var CPStringNull = [CPNull null]; /*! Returns a hash of the string instance. */ -- (unsigned)UID +- (CPString)UID { var UID = CPStringUIDs.valueForKey(self); diff --git a/Tests/AppKit/CPArrayControllerTest.j b/Tests/AppKit/CPArrayControllerTest.j index 3590f9f61..5e7f8f982 100644 --- a/Tests/AppKit/CPArrayControllerTest.j +++ b/Tests/AppKit/CPArrayControllerTest.j @@ -1079,22 +1079,22 @@ return [_contentArray count]; } -- (id)objectInItemsArrayAtIndex:(unsigned int)index +- (id)objectInItemsArrayAtIndex:(CPUInteger)index { return [_contentArray objectAtIndex:index]; } -- (void)insertObject:(id)anObject inItemsArrayAtIndex:(unsigned int)index +- (void)insertObject:(id)anObject inItemsArrayAtIndex:(CPUInteger)index { [_contentArray insertObject:anObject atIndex:index]; } -- (void)removeObjectFromItemsArrayAtIndex:(unsigned int)index +- (void)removeObjectFromItemsArrayAtIndex:(CPUInteger)index { [_contentArray removeObjectAtIndex:index]; } -- (void)replaceObjectInItemsArrayAtIndex:(unsigned int)index withObject:(id)anObject +- (void)replaceObjectInItemsArrayAtIndex:(CPUInteger)index withObject:(id)anObject { [_contentArray replaceObjectAtIndex:index withObject:anObject]; } diff --git a/Tests/Foundation/CPAttributedStringTest.j b/Tests/Foundation/CPAttributedStringTest.j index 64bb4d4de..7980124a8 100644 --- a/Tests/Foundation/CPAttributedStringTest.j +++ b/Tests/Foundation/CPAttributedStringTest.j @@ -116,7 +116,7 @@ var sharedObject = [CPObject new]; testAttributesAtIndexWithValues(string, 33, expectedValues, self); } -//- (CPDictionary)attributesAtIndex:(unsigned)anIndex longestEffectiveRange:(CPRangePointer)aRange inRange:(CPRange)rangeLimit +//- (CPDictionary)attributesAtIndex:(CPUInteger)anIndex longestEffectiveRange:(CPRangePointer)aRange inRange:(CPRange)rangeLimit - (void)testAttributesAtIndexLongestEffectiveRangeInRange { var string = [self stringForTesting]; @@ -135,7 +135,7 @@ var sharedObject = [CPObject new]; [self assertTrue:[attributes objectForKey:"f"] === 43 message:@"expecting 'f' to be 43, was: " + [attributes objectForKey:"f"]]; } -//- (id)attribute:(CPString)attribute atIndex:(unsigned)index effectiveRange:(CPRangePointer)aRange +//- (id)attribute:(CPString)attribute atIndex:(CPUInteger)index effectiveRange:(CPRangePointer)aRange - (void)testAttributeAtIndexEffectiveRange { var string = [self stringForTesting]; @@ -144,7 +144,7 @@ var sharedObject = [CPObject new]; testAttributeAtIndexWithValue(string, 20, "d", [CPNull null], self); } -//- (id)attribute:(CPString)attribute atIndex:(unsigned)index longestEffectiveRange:(CPRangePointer)aRange inRange:(CPRange)rangeLimit +//- (id)attribute:(CPString)attribute atIndex:(CPUInteger)index longestEffectiveRange:(CPRangePointer)aRange inRange:(CPRange)rangeLimit - (void)testAttributeAtIndexLongestEffectiveRangeInRange { var string = [self stringForTesting]; diff --git a/Tests/Foundation/CPKVOTest.j b/Tests/Foundation/CPKVOTest.j index 57ba2dd8c..0a4bccba5 100644 --- a/Tests/Foundation/CPKVOTest.j +++ b/Tests/Foundation/CPKVOTest.j @@ -833,17 +833,17 @@ return [managedObjects count]; } -- (id)objectInManagedObjectsAtIndex:(unsigned)anIndex +- (id)objectInManagedObjectsAtIndex:(CPUInteger)anIndex { return [managedObjects objectAtIndex:anIndex]; } -- (void)removeObjectFromManagedObjectsAtIndex:(unsigned)anIndex +- (void)removeObjectFromManagedObjectsAtIndex:(CPUInteger)anIndex { [managedObjects removeObjectAtIndex:anIndex]; } -- (void)insertObject:(id)anObject inManagedObjectsAtIndex:(unsigned)anIndex +- (void)insertObject:(id)anObject inManagedObjectsAtIndex:(CPUInteger)anIndex { [managedObjects insertObject:anObject atIndex:anIndex]; } diff --git a/Tests/Manual/ArrayController1/AppController.j b/Tests/Manual/ArrayController1/AppController.j index 056641151..ff54b1544 100644 --- a/Tests/Manual/ArrayController1/AppController.j +++ b/Tests/Manual/ArrayController1/AppController.j @@ -134,22 +134,22 @@ CPLogRegister(CPLogConsole); return [itemsArray count]; } -- (id)objectInItemsArrayAtIndex:(unsigned int)index +- (id)objectInItemsArrayAtIndex:(CPUInteger)index { return [itemsArray objectAtIndex:index]; } -- (void)insertObject:(id)anObject inItemsArrayAtIndex:(unsigned int)index +- (void)insertObject:(id)anObject inItemsArrayAtIndex:(CPUInteger)index { [itemsArray insertObject:anObject atIndex:index]; } -- (void)removeObjectFromItemsArrayAtIndex:(unsigned int)index +- (void)removeObjectFromItemsArrayAtIndex:(CPUInteger)index { [itemsArray removeObjectAtIndex:index]; } -- (void)replaceObjectInItemsArrayAtIndex:(unsigned int)index withObject:(id)anObject +- (void)replaceObjectInItemsArrayAtIndex:(CPUInteger)index withObject:(id)anObject { [itemsArray replaceObjectAtIndex:index withObject:anObject]; } diff --git a/Tools/nib2cib/NSCustomView.j b/Tools/nib2cib/NSCustomView.j index a7cc7270c..f5526c5d6 100644 --- a/Tools/nib2cib/NSCustomView.j +++ b/Tools/nib2cib/NSCustomView.j @@ -51,7 +51,7 @@ var _CPCibCustomViewClassNameKey = @"_CPCibCustomViewClassNameKey"; [aCoder encodeObject:CP_NSMapClassName(_className) forKey:_CPCibCustomViewClassNameKey]; } -- (CPString)classForKeyedArchiver +- (Class)classForKeyedArchiver { return [_CPCibCustomView class]; } From 361f421816bf614872bfde1791f754f667509f7e Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Mon, 12 Aug 2013 16:49:39 +0200 Subject: [PATCH 05/25] Fixed: Added 'id' as a token and enforce that protocol can only follow 'id' as a Objective-J type --- Objective-J/acorn.js | 88 ++++++++++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 39 deletions(-) diff --git a/Objective-J/acorn.js b/Objective-J/acorn.js index 9724bf05d..7d833098e 100644 --- a/Objective-J/acorn.js +++ b/Objective-J/acorn.js @@ -380,7 +380,8 @@ if (typeof exports != "undefined" && !exports.acorn) { var _filename = {keyword: "filename"}, _unsigned = {keyword: "unsigned", okAsIdent: true}, _signed = {keyword: "signed", okAsIdent: true}; var _byte = {keyword: "byte", okAsIdent: true}, _char = {keyword: "char", okAsIdent: true}, _short = {keyword: "short", okAsIdent: true}; - var _int = {keyword: "int", okAsIdent: true}, _long = {keyword: "long", okAsIdent: true}, _preprocess = {keyword: "#"}; + var _int = {keyword: "int", okAsIdent: true}, _long = {keyword: "long", okAsIdent: true}, _id = {keyword: "id", okAsIdent: true}; + var _preprocess = {keyword: "#"}; // Preprocessor keywords @@ -414,7 +415,7 @@ if (typeof exports != "undefined" && !exports.acorn) { // Map Objective-J keyword names to token types. var keywordTypesObjJ = {"IBAction": _action, "IBOutlet": _outlet, "unsigned": _unsigned, "signed": _signed, "byte": _byte, "char": _char, - "short": _short, "int": _int, "long": _long }; + "short": _short, "int": _int, "long": _long, "id": _id }; // Map Objective-J "@" keyword names to token types. @@ -546,7 +547,7 @@ if (typeof exports != "undefined" && !exports.acorn) { // The Objective-J keywords. - var isKeywordObjJ = makePredicate("IBAction IBOutlet byte char short int long unsigned signed"); + var isKeywordObjJ = makePredicate("IBAction IBOutlet byte char short int long unsigned signed id"); // The preprocessor keywords. @@ -2999,8 +3000,8 @@ var preIfLevel = 0; } // Parse the next token as an Objective-J typ. - // It can be an identifier followed by a optional protocol '' - // It can be 'void' + // It can be 'id' followed by a optional protocol '' + // It can be 'void' or 'id' // It can be 'signed' or 'unsigned' followed by an optional 'char', 'byte', 'short', 'int' or 'long' // It can be 'char', 'byte', 'short', 'int' or 'long' // 'int' can be followed by an optinal 'long'. 'long' can be followed by an optional extra 'long' @@ -3008,51 +3009,60 @@ var preIfLevel = 0; function parseObjectiveJType() { var node = startNode(); if (tokType === _name) { - var type = tokVal; - node.name = type; + // It should be a class name + node.name = tokVal; + node.typeisclass = true; next(); - if (type === "id" && tokVal === '<') { - var first = true, - protocols = []; - node.protocols = protocols; - do { - next(); - if (first) - first = false; - else - eat(_comma); - protocols.push(parseIdent(true)); - } while (tokVal !== '>'); - next(); - } } else { node.name = tokType.keyword; + // Do nothing more if it is 'void' if (!eat(_void)) { - var nextKeyWord; - if (eat(_signed) || eat(_unsigned)) - nextKeyWord = tokType.keyword || true; - if (eat(_char) || eat(_byte) || eat(_short)) { - if (nextKeyWord) - node.name += " " + nextKeyWord; - nextKeyWord = tokType.keyword || true; - } else { - if (eat(_int)) { - if (nextKeyWord) - node.name += " " + nextKeyWord; - nextKeyWord = tokType.keyword || true; + if (eat(_id)) { + // Is it 'id' followed by a '<' parse protocols. Do nothing more if it is only 'id' + if (tokVal === '<') { + var first = true, + protocols = []; + node.protocols = protocols; + do { + next(); + if (first) + first = false; + else + eat(_comma); + protocols.push(parseIdent(true)); + } while (tokVal !== '>'); + next(); } - if (eat(_long)) { + } else { + // Now check if it is some basic type or an approved combination of basic types + var nextKeyWord; + if (eat(_signed) || eat(_unsigned)) + nextKeyWord = tokType.keyword || true; + if (eat(_char) || eat(_byte) || eat(_short)) { if (nextKeyWord) node.name += " " + nextKeyWord; nextKeyWord = tokType.keyword || true; + } else { + if (eat(_int)) { + if (nextKeyWord) + node.name += " " + nextKeyWord; + nextKeyWord = tokType.keyword || true; + } if (eat(_long)) { - node.name += " " + nextKeyWord; + if (nextKeyWord) + node.name += " " + nextKeyWord; + nextKeyWord = tokType.keyword || true; + if (eat(_long)) { + node.name += " " + nextKeyWord; + } } } - } - if (!nextKeyWord) { - node.name = (!options.forbidReserved && tokType.keyword) || unexpected(); - next(); + if (!nextKeyWord) { + // It must be a class name if it was not a basic type. // FIXME: This is not true + node.name = (!options.forbidReserved && tokType.keyword) || unexpected(); + node.typeisclass = true; + next(); + } } } } From 4eba639c73abf19ab3f7156eaa4e533426f77efa Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Mon, 12 Aug 2013 16:50:34 +0200 Subject: [PATCH 06/25] Fixed: Allow some tokens to be identifiers --- Objective-J/acorn.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Objective-J/acorn.js b/Objective-J/acorn.js index 7d833098e..62e024b63 100644 --- a/Objective-J/acorn.js +++ b/Objective-J/acorn.js @@ -2770,6 +2770,9 @@ var preIfLevel = 0; return finishNode(node, "Dereference"); default: + if(tokType.okAsIdent) + return parseIdent(); + unexpected(); } } From 29d7833fcb49115cf005759d12d4950746a63d96 Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Mon, 12 Aug 2013 16:52:07 +0200 Subject: [PATCH 07/25] Fixed: Renamed local variable that used reserved variable name ('arguments') --- Objective-J/ObjJAcornCompiler.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Objective-J/ObjJAcornCompiler.js b/Objective-J/ObjJAcornCompiler.js index 3023ac2be..6047aa464 100644 --- a/Objective-J/ObjJAcornCompiler.js +++ b/Objective-J/ObjJAcornCompiler.js @@ -1903,7 +1903,7 @@ MethodDeclarationStatement: function(node, st, c) { methodScope = new Scope(st), isInstanceMethodType = node.methodtype === '-'; selectors = node.selectors, - arguments = node.arguments, + nodeArguments = node.arguments, returnType = node.returntype, types = [returnType ? returnType.name : "id"], returnTypeProtocols = returnType ? returnType.protocols : null; @@ -1921,8 +1921,8 @@ MethodDeclarationStatement: function(node, st, c) { compiler.jsBuffer = isInstanceMethodType ? compiler.imBuffer : compiler.cmBuffer; // Put together the selector. Maybe this should be done in the parser... - for (var i = 0; i < arguments.length; i++) { - var argument = arguments[i], + for (var i = 0; i < nodeArguments.length; i++) { + var argument = nodeArguments[i], argumentType = argument.type, argumentTypeName = argumentType ? argumentType.name : "id", argumentProtocols = argumentType ? argumentType.protocols : null; @@ -1960,9 +1960,9 @@ MethodDeclarationStatement: function(node, st, c) { compiler.jsBuffer.concat("(self, _cmd"); methodScope.methodType = node.methodtype; - if (arguments) for (var i = 0; i < arguments.length; i++) + if (nodeArguments) for (var i = 0; i < nodeArguments.length; i++) { - var argument = arguments[i], + var argument = nodeArguments[i], argumentName = argument.identifier.name; compiler.jsBuffer.concat(", "); From 2e216d7e9a1a891484cc0937200659da4d128192 Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Mon, 12 Aug 2013 16:53:19 +0200 Subject: [PATCH 08/25] Fixed: Make default return type to 'void' for '@action' or 'IBAction' marked method. --- Objective-J/ObjJAcornCompiler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objective-J/ObjJAcornCompiler.js b/Objective-J/ObjJAcornCompiler.js index 6047aa464..b8606e2b5 100644 --- a/Objective-J/ObjJAcornCompiler.js +++ b/Objective-J/ObjJAcornCompiler.js @@ -1905,7 +1905,7 @@ MethodDeclarationStatement: function(node, st, c) { selectors = node.selectors, nodeArguments = node.arguments, returnType = node.returntype, - types = [returnType ? returnType.name : "id"], + types = [returnType ? returnType.name : (node.action ? "void" : "id")], returnTypeProtocols = returnType ? returnType.protocols : null; selector = selectors[0].name; // There is always at least one selector From f74312dc422d601b4ac2e9c5200959e3caf7e7ec Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Mon, 12 Aug 2013 16:55:35 +0200 Subject: [PATCH 09/25] Fixed: Allow type on return or parameter type to be a class if superclass or protocol declared it as 'id' --- Objective-J/ObjJAcornCompiler.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Objective-J/ObjJAcornCompiler.js b/Objective-J/ObjJAcornCompiler.js index b8606e2b5..441ee1c78 100644 --- a/Objective-J/ObjJAcornCompiler.js +++ b/Objective-J/ObjJAcornCompiler.js @@ -2028,15 +2028,15 @@ MethodDeclarationStatement: function(node, st, c) { // First type is return type var returnType = declaredTypes[0]; - if (returnType !== types[0]) + if (returnType !== types[0] && !(returnType === 'id' && node.returntype.typeisclass)) compiler.addWarning(createMessage("Conflicting return type in implementation of '" + selector + "': '" + returnType + "' vs '" + types[0] + "'", node.returntype || node, compiler.source)); // Check the parameter types. The size of the two type arrays should be the same for (var i = 1; i < typeSize; i++) { var parameterType = declaredTypes[i]; - if (parameterType !== types[i]) - compiler.addWarning(createMessage("Conflicting parameter types in implementation of '" + selector + "': '" + parameterType + "' vs '" + types[i] + "'", node.arguments[i - 1].type || node.arguments[i - 1].identifier, compiler.source)); + if (parameterType !== types[i] && !(parameterType === 'id' && nodeArguments[i - 1].type.typeisclass)) + compiler.addWarning(createMessage("Conflicting parameter types in implementation of '" + selector + "': '" + parameterType + "' vs '" + types[i] + "'", nodeArguments[i - 1].type || nodeArguments[i - 1].identifier, compiler.source)); } } } From 672ed6ed0c69c71a4589b6a3b7b74b5caa7ba1ea Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Mon, 12 Aug 2013 22:41:36 +0200 Subject: [PATCH 10/25] Fixed: Handle protocol declaration with no method declarations --- Objective-J/ObjJAcornCompiler.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Objective-J/ObjJAcornCompiler.js b/Objective-J/ObjJAcornCompiler.js index 441ee1c78..099bc04d9 100644 --- a/Objective-J/ObjJAcornCompiler.js +++ b/Objective-J/ObjJAcornCompiler.js @@ -1857,18 +1857,21 @@ ProtocolDeclarationStatement: function(node, st, c) { compiler.protocolDefs[protocolName] = protocolDef; protocolScope.protocolDef = protocolDef; - var someRequired = node.required, - requiredLength = someRequired.length; + var someRequired = node.required; - if (requiredLength > 0) - { - // We only add the required methods - for (var i = 0; i < requiredLength; ++i) { - var required = someRequired[i]; - if (!generate) compiler.lastPos = required.start; - c(required, protocolScope, "Statement"); + if (someRequired) { + var requiredLength = someRequired.length; + + if (requiredLength > 0) + { + // We only add the required methods + for (var i = 0; i < requiredLength; ++i) { + var required = someRequired[i]; + if (!generate) compiler.lastPos = required.start; + c(required, protocolScope, "Statement"); + } + if (!generate) buffer.concat(compiler.source.substring(compiler.lastPos, required.end)); } - if (!generate) buffer.concat(compiler.source.substring(compiler.lastPos, required.end)); } buffer.concat("\nobjc_registerProtocol(the_protocol);\n"); From beec0c52939113faf21ee668188f38aa7da7632d Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Mon, 12 Aug 2013 22:43:03 +0200 Subject: [PATCH 11/25] Fixed: Handle '@required' before any method declarations --- Objective-J/acorn.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Objective-J/acorn.js b/Objective-J/acorn.js index 62e024b63..8e01ae60c 100644 --- a/Objective-J/acorn.js +++ b/Objective-J/acorn.js @@ -2222,6 +2222,7 @@ var preIfLevel = 0; } while(!eat(_end)) { if (tokType === _eof) raise(tokPos, "Expected '@end' after '@protocol'"); + if (eat(_required)) continue; if (eat(_optional)) { while(!eat(_required && tokType !== _end)) { (node.optional || (node.optional = [])).push(parseProtocolClassElement()); From 0b75876283340562c451683e6f5e9a85fda152d3 Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Mon, 12 Aug 2013 22:44:35 +0200 Subject: [PATCH 12/25] Fixed: Moved incorrect positioned parenthesis to handle '@required' token --- Objective-J/acorn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objective-J/acorn.js b/Objective-J/acorn.js index 8e01ae60c..445984be6 100644 --- a/Objective-J/acorn.js +++ b/Objective-J/acorn.js @@ -2224,7 +2224,7 @@ var preIfLevel = 0; if (tokType === _eof) raise(tokPos, "Expected '@end' after '@protocol'"); if (eat(_required)) continue; if (eat(_optional)) { - while(!eat(_required && tokType !== _end)) { + while(!eat(_required) && tokType !== _end) { (node.optional || (node.optional = [])).push(parseProtocolClassElement()); } } else { From 63dac5553ec38ef738ae68f92ff551c111401e3b Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Mon, 12 Aug 2013 22:46:26 +0200 Subject: [PATCH 13/25] Fixed: Updated test case to include '@required' and '@optional' keywords --- .../Preprocessor/BehaviorTests/ProtocolTest.j | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Tests/Objective-J/Preprocessor/BehaviorTests/ProtocolTest.j b/Tests/Objective-J/Preprocessor/BehaviorTests/ProtocolTest.j index 36a1a078d..99ce726de 100644 --- a/Tests/Objective-J/Preprocessor/BehaviorTests/ProtocolTest.j +++ b/Tests/Objective-J/Preprocessor/BehaviorTests/ProtocolTest.j @@ -14,7 +14,16 @@ @protocol MyProtocol3 +@required +@optional +@required - (int)myFunction3:(int)aValue; +@optional +@required + +@end + +@protocol MyProtocol4 @end From b8b96a17d732bd3b7af90bc2b73a966de52867bf Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Thu, 22 Aug 2013 12:34:14 +0200 Subject: [PATCH 14/25] Fixed: Check if global function exists in correct way --- Objective-J/ObjJAcornCompiler.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Objective-J/ObjJAcornCompiler.js b/Objective-J/ObjJAcornCompiler.js index 099bc04d9..a801cdc6a 100644 --- a/Objective-J/ObjJAcornCompiler.js +++ b/Objective-J/ObjJAcornCompiler.js @@ -499,7 +499,7 @@ ObjJAcornCompiler.prototype.getClassDef = function(/* String */ aClassName) if (c) return c; - if (objj_getClass) + if (typeof objj_getClass === 'function') { var aClass = objj_getClass(aClassName); if (aClass) @@ -547,7 +547,7 @@ ObjJAcornCompiler.prototype.getProtocolDef = function(/* String */ aProtocolName if (p) return p; - if (objj_getProtocol) + if (typeof objj_getProtocol === 'function') { var aProtocol = objj_getProtocol(aProtocolName); if (aProtocol) From c326168e83ee3cbb3be4b0576293464905fa5b29 Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Thu, 22 Aug 2013 12:35:16 +0200 Subject: [PATCH 15/25] Fixed: Protocol definition in compiler was not created correct from protocol definition in the runtime --- Objective-J/ObjJAcornCompiler.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Objective-J/ObjJAcornCompiler.js b/Objective-J/ObjJAcornCompiler.js index a801cdc6a..6957889e4 100644 --- a/Objective-J/ObjJAcornCompiler.js +++ b/Objective-J/ObjJAcornCompiler.js @@ -552,22 +552,22 @@ ObjJAcornCompiler.prototype.getProtocolDef = function(/* String */ aProtocolName var aProtocol = objj_getProtocol(aProtocolName); if (aProtocol) { - var protocol = protocols[i], - protocolName = protocol_getName(protocol), - requiredInstanceMethods = protocol_copyMethodDescriptionList(protocol, true, true), + var protocolName = protocol_getName(aProtocol), + requiredInstanceMethods = protocol_copyMethodDescriptionList(aProtocol, true, true), requiredInstanceMethodDefs = ObjJAcornCompiler.methodDefsFromMethodList(requiredInstanceMethods), - requiredClassMethods = protocol_copyMethodDescriptionList(protocol, true, false), + requiredClassMethods = protocol_copyMethodDescriptionList(aProtocol, true, false), requiredClassMethodDefs = ObjJAcornCompiler.methodDefsFromMethodList(requiredClassMethods), - protocols = protocol.protocols, + protocols = aProtocol.protocols, inheritFromProtocols = []; - for (var i = 0, size = protocols.length; i < size; i++) - inheritFromProtocols.push(compiler.getProtocolDef(protocols[i].name)); + if (protocols) + for (var i = 0, size = protocols.length; i < size; i++) + inheritFromProtocols.push(compiler.getProtocolDef(protocols[i].name)); - p = new ProtocolDef(protocolName, inheritFromProtocols, requiredInstanceMethodDefs, requiredClassMethodDefs); + p = new ProtocolDef(protocolName, inheritFromProtocols, requiredInstanceMethodDefs, requiredClassMethodDefs); this.protocolDefs[aProtocolName] = p; - return c; + return p; } } From cfc682c165b9411271e55a1d543f696791a26840 Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Thu, 22 Aug 2013 12:36:29 +0200 Subject: [PATCH 16/25] Fixed: Protocol methods is now registered in the correct place --- Objective-J/ObjJAcornCompiler.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Objective-J/ObjJAcornCompiler.js b/Objective-J/ObjJAcornCompiler.js index 6957889e4..ce1aa9fa4 100644 --- a/Objective-J/ObjJAcornCompiler.js +++ b/Objective-J/ObjJAcornCompiler.js @@ -1881,7 +1881,7 @@ ProtocolDeclarationStatement: function(node, st, c) { { buffer.concat("protocol_addMethodDescriptions(the_protocol, ["); buffer.atoms.push.apply(buffer.atoms, compiler.imBuffer.atoms); // FIXME: Move this append to StringBuffer - buffer.concat("], true, false);\n"); + buffer.concat("], true, true);\n"); } // Add class methods @@ -1889,7 +1889,7 @@ ProtocolDeclarationStatement: function(node, st, c) { { buffer.concat("protocol_addMethodDescriptions(the_protocol, ["); buffer.atoms.push.apply(buffer.atoms, compiler.cmBuffer.atoms); // FIXME: Move this append to StringBuffer - buffer.concat("], true, true);\n"); + buffer.concat("], true, false);\n"); } buffer.concat("}"); From 0afe21dd2958fb626e9f4399dc09260ad635ec72 Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Thu, 22 Aug 2013 12:37:29 +0200 Subject: [PATCH 17/25] Fixed: Copy method descriptions to an array instead of JSObject --- Objective-J/Runtime.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Objective-J/Runtime.js b/Objective-J/Runtime.js index b9de057f6..ed01be5da 100644 --- a/Objective-J/Runtime.js +++ b/Objective-J/Runtime.js @@ -420,7 +420,17 @@ GLOBAL(protocol_addMethodDescriptions) = function(/*Protocol*/ proto, /*Array*/ GLOBAL(protocol_copyMethodDescriptionList) = function(/*Protocol*/ proto, /*BOOL*/ isRequiredMethod, /*BOOL*/ isInstanceMethod) { - return isRequiredMethod ? (isInstanceMethod ? proto.instance_methods : proto.class_methods).slice(0) : []; + if (!isRequiredMethod) + return []; + + var method_dtable = isInstanceMethod ? proto.instance_methods : proto.class_methods, + methodList = []; + + for (var selector in method_dtable) + if (method_dtable.hasOwnProperty(selector)) + methodList.push(method_dtable[selector]); + + return methodList; } GLOBAL(protocol_addProtocol) = function(/*Protocol*/ proto, /*Protocol*/ addition) From 9f7d0578e52dfc7bb57bd52794cd82b9cb143f6d Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Thu, 22 Aug 2013 14:31:15 +0200 Subject: [PATCH 18/25] New: Added the basic protocols CPObject and CPCoding --- AppKit/CPResponder.j | 2 +- Foundation/CPObject.j | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/AppKit/CPResponder.j b/AppKit/CPResponder.j index 1bf73056d..08e3db3ac 100644 --- a/AppKit/CPResponder.j +++ b/AppKit/CPResponder.j @@ -356,7 +356,7 @@ CPDeleteForwardKeyCode = 46; var CPResponderNextResponderKey = @"CPResponderNextResponderKey", CPResponderMenuKey = @"CPResponderMenuKey"; -@implementation CPResponder (CPCoding) +@implementation CPResponder (CPCoding) /*! Initializes the responder with data from a coder. diff --git a/Foundation/CPObject.j b/Foundation/CPObject.j index 72b877c9f..ae5a39ac1 100644 --- a/Foundation/CPObject.j +++ b/Foundation/CPObject.j @@ -67,7 +67,42 @@ CPLog(@"Got some class: %@", inst); @global CPInvalidArgumentException -@implementation CPObject + +@protocol CPObject + +- (BOOL)isEqual:(id)object; +- (CPUInteger)hash; + +- (Class)superclass; +- (Class)class; +- (id)self; + +- (id)performSelector:(SEL)aSelector; +- (id)performSelector:(SEL)aSelector withObject:(id)object; +- (id)performSelector:(SEL)aSelector withObject:(id)object1 withObject:(id)object2; + +- (BOOL)isProxy; + +- (BOOL)isKindOfClass:(Class)aClass; +- (BOOL)isMemberOfClass:(Class)aClass; +- (BOOL)conformsToProtocol:(Protocol)aProtocol; + +- (BOOL)respondsToSelector:(SEL)aSelector; + +- (CPString)description; +@optional +- (CPString)debugDescription; + +@end + +@protocol CPCoding + +- (void)encodeWithCoder:(CPCoder)aCoder; +- (id)initWithCoder:(CPCoder)aDecoder; + +@end + +@implementation CPObject { Class isa; } From 9eebb0a64b2baef4b8e607d32726dd866d4d7209 Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Thu, 22 Aug 2013 16:53:22 +0200 Subject: [PATCH 19/25] Fixed: Pass correct node to error message when finding duplicated protocol --- Objective-J/ObjJAcornCompiler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objective-J/ObjJAcornCompiler.js b/Objective-J/ObjJAcornCompiler.js index ce1aa9fa4..39685ca3d 100644 --- a/Objective-J/ObjJAcornCompiler.js +++ b/Objective-J/ObjJAcornCompiler.js @@ -1829,7 +1829,7 @@ ProtocolDeclarationStatement: function(node, st, c) { inheritFromProtocols = []; if (protocolDef) - throw compiler.error_message("Duplicate protocol " + protocolName, node.protocolName); + throw compiler.error_message("Duplicate protocol " + protocolName, node.protocolname); compiler.imBuffer = new StringBuffer(); compiler.cmBuffer = new StringBuffer(); From 0e4ad998d8c37c59c99e14053ce0fdaed830742c Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Thu, 22 Aug 2013 16:54:19 +0200 Subject: [PATCH 20/25] Fixed: Remove all protocols in objj_resetRegisterClasses --- Objective-J/Runtime.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Objective-J/Runtime.js b/Objective-J/Runtime.js index ed01be5da..a61e139ad 100644 --- a/Objective-J/Runtime.js +++ b/Objective-J/Runtime.js @@ -594,6 +594,7 @@ GLOBAL(objj_resetRegisterClasses) = function() delete global[key]; REGISTERED_CLASSES = {}; + REGISTERED_PROTOCOLS = {}; resetBundle(); } From c979a69e6b06619dcea6ea571ced727e6fff331e Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Wed, 28 Aug 2013 11:23:55 +0200 Subject: [PATCH 21/25] Fixed: Compiler can now handle only @action/IBAction declared return type when checking for 'Conflicting return type' method declaration. Also made the warning message point to correct return type token when type is not declared. --- Objective-J/ObjJAcornCompiler.js | 9 +++++---- Objective-J/acorn.js | 13 ++++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Objective-J/ObjJAcornCompiler.js b/Objective-J/ObjJAcornCompiler.js index 39685ca3d..61318fbc5 100644 --- a/Objective-J/ObjJAcornCompiler.js +++ b/Objective-J/ObjJAcornCompiler.js @@ -2029,12 +2029,13 @@ MethodDeclarationStatement: function(node, st, c) { var typeSize = declaredTypes.length; if (typeSize > 0) { // First type is return type - var returnType = declaredTypes[0]; + var declaredReturnType = declaredTypes[0]; - if (returnType !== types[0] && !(returnType === 'id' && node.returntype.typeisclass)) - compiler.addWarning(createMessage("Conflicting return type in implementation of '" + selector + "': '" + returnType + "' vs '" + types[0] + "'", node.returntype || node, compiler.source)); + // Create warning if return types is not the same. It is ok if superclass has 'id' and subclass has a class type + if (declaredReturnType !== types[0] && !(declaredReturnType === 'id' && returnType && returnType.typeisclass)) + compiler.addWarning(createMessage("Conflicting return type in implementation of '" + selector + "': '" + declaredReturnType + "' vs '" + types[0] + "'", returnType || node.action || selectors[0], compiler.source)); - // Check the parameter types. The size of the two type arrays should be the same + // Check the parameter types. The size of the two type arrays should be the same as they have the same selector. for (var i = 1; i < typeSize; i++) { var parameterType = declaredTypes[i]; diff --git a/Objective-J/acorn.js b/Objective-J/acorn.js index 445984be6..f12994057 100644 --- a/Objective-J/acorn.js +++ b/Objective-J/acorn.js @@ -2369,10 +2369,13 @@ var preIfLevel = 0; expect(_plusmin, "Method declaration must start with '+' or '-'"); // If we find a '(' we have a return type to parse if (eat(_parenL)) { - if (eat(_action)) - node.action = true; + var typeNode = startNode(); + if (eat(_action)) { + node.action = finishNode(typeNode, "ObjectiveJActionType"); + typeNode = startNode(); + } if (!eat(_parenR)) { - node.returntype = parseObjectiveJType(); + node.returntype = parseObjectiveJType(typeNode); expect(_parenR, "Expected closing ')' after method return type"); } } @@ -3010,8 +3013,8 @@ var preIfLevel = 0; // It can be 'char', 'byte', 'short', 'int' or 'long' // 'int' can be followed by an optinal 'long'. 'long' can be followed by an optional extra 'long' - function parseObjectiveJType() { - var node = startNode(); + function parseObjectiveJType(startFrom) { + var node = startFrom ? startNodeFrom(startFrom) : startNode(); if (tokType === _name) { // It should be a class name node.name = tokVal; From ba0604320e4aa9129f729d4aa99c2a1f02e43039 Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Sat, 31 Aug 2013 15:33:32 +0200 Subject: [PATCH 22/25] Fixed: Should be 'objj_allocateProtocol' and 'objj_registerProtocol' not 'objc_allocateProtocol' and 'objc_registerProtocol' --- Objective-J/ObjJAcornCompiler.js | 8 ++++---- Objective-J/Runtime.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Objective-J/ObjJAcornCompiler.js b/Objective-J/ObjJAcornCompiler.js index 61318fbc5..06bf47364 100644 --- a/Objective-J/ObjJAcornCompiler.js +++ b/Objective-J/ObjJAcornCompiler.js @@ -1836,7 +1836,7 @@ ProtocolDeclarationStatement: function(node, st, c) { if (!generate) buffer.concat(compiler.source.substring(compiler.lastPos, node.start)); - buffer.concat("{var the_protocol = objc_allocateProtocol(\"" + protocolName + "\");"); + buffer.concat("{var the_protocol = objj_allocateProtocol(\"" + protocolName + "\");"); if (protocols) for (var i = 0, size = protocols.length; i < size; i++) { @@ -1874,7 +1874,7 @@ ProtocolDeclarationStatement: function(node, st, c) { } } - buffer.concat("\nobjc_registerProtocol(the_protocol);\n"); + buffer.concat("\nobjj_registerProtocol(the_protocol);\n"); // Add instance methods if (compiler.imBuffer.isEmpty()) @@ -1932,8 +1932,8 @@ MethodDeclarationStatement: function(node, st, c) { types.push(argumentType ? argumentType.name : "id"); - if (argumentProtocols) for (var i = 0, size = argumentProtocols.length; i < size; i++) { - var argumentProtocol = argumentProtocols[i]; + if (argumentProtocols) for (var j = 0, size = argumentProtocols.length; j < size; j++) { + var argumentProtocol = argumentProtocols[j]; if (!compiler.getProtocolDef(argumentProtocol.name)) { compiler.addWarning(createMessage("Cannot find protocol declaration for '" + argumentProtocol.name + "'", argumentProtocol, compiler.source)); } diff --git a/Objective-J/Runtime.js b/Objective-J/Runtime.js index a61e139ad..3d50604fa 100644 --- a/Objective-J/Runtime.js +++ b/Objective-J/Runtime.js @@ -376,14 +376,14 @@ GLOBAL(protocol_conformsToProtocol) = function(/*Protocol*/ p1, /*Protocol*/ p2) var REGISTERED_PROTOCOLS = { }; -GLOBAL(objc_allocateProtocol) = function(/*String*/ aName) +GLOBAL(objj_allocateProtocol) = function(/*String*/ aName) { var protocol = new objj_protocol(aName); return protocol; } -GLOBAL(objc_registerProtocol) = function(/*Protocol*/ proto) +GLOBAL(objj_registerProtocol) = function(/*Protocol*/ proto) { REGISTERED_PROTOCOLS[proto.name] = proto; } From 9f0d8c54e403d24a5e45ac18fe59c31ca4b4a4b5 Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Thu, 12 Sep 2013 21:47:15 +0200 Subject: [PATCH 23/25] Fixed: Uses current protocolDefs when compiling accessors This caused 'null is not an object' type error when class declaration with 'accessors' declared ivars was in the same file as the protocol it was conforming to. --- Objective-J/ObjJAcornCompiler.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Objective-J/ObjJAcornCompiler.js b/Objective-J/ObjJAcornCompiler.js index 06bf47364..9b1394f7a 100644 --- a/Objective-J/ObjJAcornCompiler.js +++ b/Objective-J/ObjJAcornCompiler.js @@ -413,9 +413,9 @@ exports.ObjJAcornCompiler.compileToExecutable = function(/*String*/ aString, /*C return new ObjJAcornCompiler(aString, aURL, flags, 2).executable(); } -exports.ObjJAcornCompiler.compileToIMBuffer = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned*/ flags, classDefs) +exports.ObjJAcornCompiler.compileToIMBuffer = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned*/ flags, classDefs, protocolDefs) { - return new ObjJAcornCompiler(aString, aURL, flags, 2, classDefs).IMBuffer(); + return new ObjJAcornCompiler(aString, aURL, flags, 2, classDefs, protocolDefs).IMBuffer(); } exports.ObjJAcornCompiler.compileFileDependencies = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned*/ flags) @@ -1745,7 +1745,7 @@ ClassDeclarationStatement: function(node, st, c) { // Remove all @accessors or we will get a recursive loop in infinity var b = getterSetterBuffer.toString().replace(/@accessors(\(.*\))?/g, ""); - var imBuffer = ObjJAcornCompiler.compileToIMBuffer(b, "Accessors", compiler.flags, compiler.classDefs); + var imBuffer = ObjJAcornCompiler.compileToIMBuffer(b, "Accessors", compiler.flags, compiler.classDefs, compiler.protocolDefs); // Add the accessors methods first to instance method buffer. // This will allow manually added set and get methods to override the compiler generated From f0e2daf6c75116631b4a261f4b42b9d1f2aee7f2 Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Thu, 12 Sep 2013 21:54:57 +0200 Subject: [PATCH 24/25] Fixed: Add get and set instance methods to class definition when ivar has accessors. This caused 'Method is not implemented' warnings when a class implemented protocol declared set and get methods as 'accessors' on an ivar. --- Objective-J/ObjJAcornCompiler.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/Objective-J/ObjJAcornCompiler.js b/Objective-J/ObjJAcornCompiler.js index 9b1394f7a..da2b773c1 100644 --- a/Objective-J/ObjJAcornCompiler.js +++ b/Objective-J/ObjJAcornCompiler.js @@ -1662,7 +1662,8 @@ ClassDeclarationStatement: function(node, st, c) { ivarType = ivarDecl.ivartype ? ivarDecl.ivartype.name : null, ivarName = ivarDecl.id.name, ivars = classDef.ivars, - ivar = {"type": ivarType, "name": ivarName}; + ivar = {"type": ivarType, "name": ivarName}, + accessors = ivarDecl.accessors; if (ivars[ivarName]) throw compiler.error_message("Instance variable '" + ivarName + "'is already declared for class " + className, ivarDecl.id); @@ -1687,8 +1688,26 @@ ClassDeclarationStatement: function(node, st, c) { classScope.ivars = Object.create(null); classScope.ivars[ivarName] = {type: "ivar", name: ivarName, node: ivarDecl.id, ivar: ivar}; - if (!hasAccessors && ivarDecl.accessors) + if (accessors) { + // TODO: This next couple of lines for getting getterName and setterName are duplicated from below. Create functions for this. + var property = (accessors.property && accessors.property.name) || ivarName, + getterName = (accessors.getter && accessors.getter.name) || property; + + classDef.addInstanceMethod(new MethodDef(getterName, [ivarType])); + + if (!accessors.readonly) { + var setterName = accessors.setter ? accessors.setter.name : null; + + if (!setterName) + { + var start = property.charAt(0) == '_' ? 1 : 0; + + setterName = (start ? "_" : "") + "set" + property.substr(start, 1).toUpperCase() + property.substring(start + 1) + ":"; + } + classDef.addInstanceMethod(new MethodDef(setterName, ["void", ivarType])); + } hasAccessors = true; + } } if (!firstIvarDeclaration) From e511638962eb2005947b739635fe75381431e9a0 Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Sun, 24 Nov 2013 22:21:56 +0100 Subject: [PATCH 25/25] Fixed: Cleaned up return and parameter types on methods. --- AppKit/CPBrowser.j | 18 ++--- AppKit/CPCollectionView.j | 2 +- AppKit/CPDatePicker/CPDatePicker.j | 10 +-- AppKit/CPMenuItem/_CPMenuItemMenuBarView.j | 8 +- AppKit/CPOutlineView.j | 26 +++---- AppKit/CPRuleEditor/CPPredicateEditor.j | 2 +- .../CPPredicateEditorRowTemplate.j | 4 +- AppKit/CPRuleEditor/CPRuleEditor.j | 28 +++---- AppKit/CPTableColumn.j | 4 +- AppKit/CPTableHeaderView.j | 24 +++--- AppKit/CPTableView.j | 76 +++++++++---------- AppKit/CPTextField.j | 2 +- AppKit/CPToolbar.j | 2 +- AppKit/_CPAutocompleteMenu.j | 2 +- AppKit/_CPPopUpList.j | 4 +- Tests/AppKit/CPKeyValueBindingTest.j | 2 +- Tests/AppKit/CPTableViewTest.j | 8 +- Tests/AppKit/CPTextFieldTest.j | 2 +- .../01_WithoutBindings/TableViewDataSource.j | 8 +- .../02_WithBindings/TableViewDataSource.j | 4 +- Tests/Foundation/CPOperationQueueTest.j | 2 +- Tests/Foundation/CPOperationTest.j | 2 +- Tests/Manual/ArrayController1/AppController.j | 4 +- Tests/Manual/CPBrowserTest/AppController.j | 6 +- .../AppController.j | 2 +- .../Manual/CPRuleEditorCibTest/RuleDelegate.j | 4 +- .../CPTableViewGroupRows/AppController.j | 6 +- .../FontEnhancementTest/AppController.j | 2 +- Tests/Manual/LongBindings/AppController.j | 2 +- Tests/Manual/NSBrowserTest/AppController.j | 6 +- .../Manual/NewTextFieldBezel/AppController.j | 4 +- .../SmartFoldersDemo/BadgedOutlineView.j | 2 +- .../TableTest/BorderTableTest/AppController.j | 2 +- .../TableTest/ColumnResize/AppController.j | 4 +- .../TableTest/ColumnSizing2/AppController.j | 2 +- .../Manual/TableTest/DataView/AppController.j | 2 +- .../DelegateSelectionTest/AppController.j | 6 +- .../TableTest/DragAndDrop/AppController.j | 6 +- .../TableTest/DrawRowTest/AppController.j | 2 +- .../Manual/TableTest/Editing/AppController.j | 4 +- .../TableTest/EditingControls/AppController.j | 14 ++-- .../TableTest/GroupRowTest/AppController.j | 4 +- .../Manual/TableTest/OldTest/AppController.j | 12 +-- .../TableTest/TableCibTest/AppController.j | 4 +- .../TableTest/TestTemplate_AppController.j | 2 +- .../TableTest/VariableRows/AppController.j | 8 +- .../TableTest/ViewBased/AppController.j | 2 +- .../TableTest/ViewBasedCib/AppController.j | 6 +- Tests/Manual/ThemeBrowser/AppController.j | 2 +- 49 files changed, 180 insertions(+), 180 deletions(-) diff --git a/AppKit/CPBrowser.j b/AppKit/CPBrowser.j index 0c764943b..a6a16306d 100644 --- a/AppKit/CPBrowser.j +++ b/AppKit/CPBrowser.j @@ -171,7 +171,7 @@ [self addColumn]; } -- (void)setLastColumn:(int)columnIndex +- (void)setLastColumn:(CPInteger)columnIndex { if (columnIndex >= _tableViews.length) return; @@ -291,7 +291,7 @@ [aTableView addTableColumn:column]; } -- (void)reloadColumn:(int)column +- (void)reloadColumn:(CPInteger)column { [[self tableViewInColumn:column] reloadData]; } @@ -359,7 +359,7 @@ // ITEMS -- (id)itemAtRow:(int)row inColumn:(int)column +- (id)itemAtRow:(CPInteger)row inColumn:(CPInteger)column { return [_tableDelegates[column] childAtIndex:row]; } @@ -369,7 +369,7 @@ return [_delegate respondsToSelector:@selector(browser:isLeafItem:)] && [_delegate browser:self isLeafItem:item]; } -- (id)parentForItemsInColumn:(int)column +- (id)parentForItemsInColumn:(CPInteger)column { return [_tableDelegates[column] _item]; } @@ -652,7 +652,7 @@ [_tableViews makeObjectsPerformSelector:@selector(registerForDraggedTypes:) withObject:types]; } -- (BOOL)canDragRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(int)columnIndex withEvent:(CPEvent)dragEvent +- (BOOL)canDragRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(CPInteger)columnIndex withEvent:(CPEvent)dragEvent { if ([_delegate respondsToSelector:@selector(browser:canDragRowsWithIndexes:inColumn:withEvent:)]) return [_delegate browser:self canDragRowsWithIndexes:rowIndexes inColumn:columnIndex withEvent:dragEvent]; @@ -660,7 +660,7 @@ return YES; } -- (CPImage)draggingImageForRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(int)columnIndex withEvent:(CPEvent)dragEvent offset:(CGPoint)dragImageOffset +- (CPImage)draggingImageForRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(CPInteger)columnIndex withEvent:(CPEvent)dragEvent offset:(CGPoint)dragImageOffset { if ([_delegate respondsToSelector:@selector(browser:draggingImageForRowsWithIndexes:inColumn:withEvent:offset:)]) return [_delegate browser:self draggingImageForRowsWithIndexes:rowIndexes inColumn:columnIndex withEvent:dragEvent offset:dragImageOffset]; @@ -668,7 +668,7 @@ return nil; } -- (CPView)draggingViewForRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(int)columnIndex withEvent:(CPEvent)dragEvent offset:(CGPoint)dragImageOffset +- (CPView)draggingViewForRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(CPInteger)columnIndex withEvent:(CPEvent)dragEvent offset:(CGPoint)dragImageOffset { if ([_delegate respondsToSelector:@selector(browser:draggingViewForRowsWithIndexes:inColumn:withEvent:offset:)]) return [_delegate browser:self draggingViewForRowsWithIndexes:rowIndexes inColumn:columnIndex withEvent:dragEvent offset:dragImageOffset]; @@ -907,7 +907,7 @@ return [_delegate browser:_browser child:index ofItem:_item]; } -- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id)info row:(int)row dropOperation:(CPTableViewDropOperation)operation +- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id)info row:(CPInteger)row dropOperation:(CPTableViewDropOperation)operation { if ([_delegate respondsToSelector:@selector(browser:acceptDrop:atRow:column:dropOperation:)]) return [_delegate browser:_browser acceptDrop:info atRow:row column:_index dropOperation:operation]; @@ -915,7 +915,7 @@ return NO; } -- (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(id)info proposedRow:(int)row proposedDropOperation:(CPTableViewDropOperation)operation +- (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(id)info proposedRow:(CPInteger)row proposedDropOperation:(CPTableViewDropOperation)operation { if ([_delegate respondsToSelector:@selector(browser:validateDrop:proposedRow:column:dropOperation:)]) return [_delegate browser:_browser validateDrop:info proposedRow:row column:_index dropOperation:operation]; diff --git a/AppKit/CPCollectionView.j b/AppKit/CPCollectionView.j index 725cafe13..8b5955763 100644 --- a/AppKit/CPCollectionView.j +++ b/AppKit/CPCollectionView.j @@ -830,7 +830,7 @@ var HORIZONTAL_MARGIN = 2; [self tile]; } -- (void)setUniformSubviewsResizing:(float)flag +- (void)setUniformSubviewsResizing:(BOOL)flag { _uniformSubviewsResizing = flag; [self tileIfNeeded:NO]; diff --git a/AppKit/CPDatePicker/CPDatePicker.j b/AppKit/CPDatePicker/CPDatePicker.j index a96b75ccc..fbb611a1e 100644 --- a/AppKit/CPDatePicker/CPDatePicker.j +++ b/AppKit/CPDatePicker/CPDatePicker.j @@ -71,7 +71,7 @@ CPEraDatePickerElementFlag = 0x0100; //CPCalendar _calendar @accessors(property=calendar); CPTimeZone _timeZone @accessors(property=timeZone); id _delegate @accessors(property=delegate); - unsigned _datePickerElements @accessors(property=datePickerElements); + CPInteger _datePickerElements @accessors(property=datePickerElements); CPInteger _datePickerMode @accessors(property=datePickerMode); CPInteger _datePickerStyle @accessors(property=datePickerStyle); CPInteger _timeInterval @accessors(property=timeInterval); @@ -366,7 +366,7 @@ CPEraDatePickerElementFlag = 0x0100; /*! Set the syle of the datePicker @param aDatePickerStyle the datePicker style */ -- (void)setDatePickerStyle:(CPDate)aDatePickerStyle +- (void)setDatePickerStyle:(CPInteger)aDatePickerStyle { _datePickerStyle = aDatePickerStyle; @@ -377,7 +377,7 @@ CPEraDatePickerElementFlag = 0x0100; /*! Set the elements of the datePicker @param aDatePickerElements the datePicker elements */ -- (void)setDatePickerElements:(CPDate)aDatePickerElements +- (void)setDatePickerElements:(CPInteger)aDatePickerElements { _datePickerElements = aDatePickerElements; @@ -388,7 +388,7 @@ CPEraDatePickerElementFlag = 0x0100; /*! Set the mode of the datePicker @param aDatePickerMode the datePicker mode */ -- (void)setDatePickerMode:(CPDate)aDatePickerMode +- (void)setDatePickerMode:(CPInteger)aDatePickerMode { _datePickerMode = aDatePickerMode; @@ -688,4 +688,4 @@ var CPDatePickerModeKey = @"CPDatePickerModeKey", self.setMilliseconds(99); } -@end \ No newline at end of file +@end diff --git a/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j b/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j index 07e80745b..265b78867 100644 --- a/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j +++ b/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j @@ -84,25 +84,25 @@ return self; } -- (CPColor)setTextColor:(CPColor)aColor +- (void)setTextColor:(CPColor)aColor { _textColor = aColor; [self setNeedsLayout]; } -- (CPColor)setTextShadowColor:(CPColor)aColor +- (void)setTextShadowColor:(CPColor)aColor { _textShadowColor = aColor; [self setNeedsLayout]; } -- (CPColor)setHighlightTextColor:(CPColor)aColor +- (void)setHighlightTextColor:(CPColor)aColor { _highlightTextColor = aColor; [self setNeedsLayout]; } -- (CPColor)setHighlightTextShadowColor:(CPColor)aColor +- (void)setHighlightTextShadowColor:(CPColor)aColor { _highlightTextShadowColor = aColor; [self setNeedsLayout]; diff --git a/AppKit/CPOutlineView.j b/AppKit/CPOutlineView.j index 016a7b605..c4b576e46 100644 --- a/AppKit/CPOutlineView.j +++ b/AppKit/CPOutlineView.j @@ -1078,7 +1078,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0, @ignore We need to offset the dataview and add the disclosure triangle. */ -- (CPView)_dragViewForColumn:(int)theColumnIndex event:(CPEvent)theDragEvent offset:(CGPoint)theDragViewOffset +- (CPView)_dragViewForColumn:(CPInteger)theColumnIndex event:(CPEvent)theDragEvent offset:(CGPoint)theDragViewOffset { var dragView = [[_CPColumnDragView alloc] initWithLineColor:[self gridColor]], tableColumn = [[self tableColumns] objectAtIndex:theColumnIndex], @@ -1211,7 +1211,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0, /*! @ignore */ -- (id)_parentItemForUpperRow:(int)theUpperRowIndex andLowerRow:(int)theLowerRowIndex atMouseOffset:(CGPoint)theOffset +- (id)_parentItemForUpperRow:(CPInteger)theUpperRowIndex andLowerRow:(CPInteger)theLowerRowIndex atMouseOffset:(CGPoint)theOffset { if (_shouldRetargetItem) return _retargetedItem; @@ -1241,7 +1241,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0, /*! @ignore */ -- (CGRect)_rectForDropHighlightViewBetweenUpperRow:(int)theUpperRowIndex andLowerRow:(int)theLowerRowIndex offset:(CGPoint)theOffset +- (CGRect)_rectForDropHighlightViewBetweenUpperRow:(CPInteger)theUpperRowIndex andLowerRow:(CPInteger)theLowerRowIndex offset:(CGPoint)theOffset { // Call super and the update x to reflect the current indentation level var rect = [super _rectForDropHighlightViewBetweenUpperRow:theUpperRowIndex andLowerRow:theLowerRowIndex offset:theOffset], @@ -1807,7 +1807,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt return [_outlineView._outlineViewDataSource outlineView:_outlineView writeItems:items toPasteboard:thePasteboard]; } -- (int)_childIndexForDropOperation:(CPTableViewDropOperation)theDropOperation row:(int)theRow offset:(CGPoint)theOffset +- (int)_childIndexForDropOperation:(CPTableViewDropOperation)theDropOperation row:(CPInteger)theRow offset:(CGPoint)theOffset { if (_outlineView._shouldRetargetChildIndex) return _outlineView._retargedChildIndex; @@ -1831,7 +1831,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt return childIndex; } -- (void)_parentItemForDropOperation:(CPTableViewDropOperation)theDropOperation row:(int)theRow offset:(CGPoint)theOffset +- (void)_parentItemForDropOperation:(CPTableViewDropOperation)theDropOperation row:(CPInteger)theRow offset:(CGPoint)theOffset { if (theDropOperation === CPTableViewDropAbove) return [_outlineView _parentItemForUpperRow:theRow - 1 andLowerRow:theRow atMouseOffset:theOffset] @@ -1840,7 +1840,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt } - (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(id /*< CPDraggingInfo >*/)theInfo - proposedRow:(int)theRow proposedDropOperation:(CPTableViewDropOperation)theOperation + proposedRow:(CPInteger)theRow proposedDropOperation:(CPTableViewDropOperation)theOperation { if (!(_outlineView._implementedOutlineViewDataSourceMethods & CPOutlineViewDataSource_outlineView_validateDrop_proposedItem_proposedChildIndex_)) return CPDragOperationNone; @@ -1859,7 +1859,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt return [_outlineView._outlineViewDataSource outlineView:_outlineView validateDrop:theInfo proposedItem:parentItem proposedChildIndex:childIndex]; } -- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id /**/)theInfo row:(int)theRow dropOperation:(CPTableViewDropOperation)theOperation +- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id /**/)theInfo row:(CPInteger)theRow dropOperation:(CPTableViewDropOperation)theOperation { if (!(_outlineView._implementedOutlineViewDataSourceMethods & CPOutlineViewDataSource_outlineView_acceptDrop_item_childIndex_)) return NO; @@ -1903,7 +1903,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt return self; } -- (BOOL)tableView:(CPTableView)theTableView shouldSelectRow:(int)theRow +- (BOOL)tableView:(CPTableView)theTableView shouldSelectRow:(CPInteger)theRow { return SHOULD_SELECT_ITEM(_outlineView, [_outlineView itemAtRow:theRow]); } @@ -1913,7 +1913,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt return SELECTION_SHOULD_CHANGE(_outlineView); } -- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aColumn row:(int)aRow +- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow { if ((_outlineView._implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_shouldEditTableColumn_item_)) return [_outlineView._outlineViewDelegate outlineView:_outlineView shouldEditTableColumn:aColumn item:[_outlineView itemAtRow:aRow]]; @@ -1921,7 +1921,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt return NO; } -- (float)tableView:(CPTableView)theTableView heightOfRow:(int)theRow +- (float)tableView:(CPTableView)theTableView heightOfRow:(CPInteger)theRow { if ((_outlineView._implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_heightOfRowByItem_)) return [_outlineView._outlineViewDelegate outlineView:_outlineView heightOfRowByItem:[_outlineView itemAtRow:theRow]]; @@ -1929,7 +1929,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt return [theTableView rowHeight]; } -- (void)tableView:(CPTableView)aTableView willDisplayView:(id)aView forTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex +- (void)tableView:(CPTableView)aTableView willDisplayView:(id)aView forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex { if ((_outlineView._implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_willDisplayView_forTableColumn_item_)) { @@ -1938,7 +1938,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt } } -- (BOOL)tableView:(CPTableView)aTableView isGroupRow:(int)aRow +- (BOOL)tableView:(CPTableView)aTableView isGroupRow:(CPInteger)aRow { if ((_outlineView._implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_isGroupItem_)) return [_outlineView._outlineViewDelegate outlineView:_outlineView isGroupItem:[_outlineView itemAtRow:aRow]]; @@ -1946,7 +1946,7 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt return NO; } -- (CPMenu)tableView:(CPTableView)aTableView menuForTableColumn:(CPTableColumn)aTableColumn row:(int)aRow +- (CPMenu)tableView:(CPTableView)aTableView menuForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRow { if ((_outlineView._implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_menuForTableColumn_item_)) { diff --git a/AppKit/CPRuleEditor/CPPredicateEditor.j b/AppKit/CPRuleEditor/CPPredicateEditor.j index 989268203..16cf1f685 100644 --- a/AppKit/CPRuleEditor/CPPredicateEditor.j +++ b/AppKit/CPRuleEditor/CPPredicateEditor.j @@ -505,7 +505,7 @@ return [[rowItem children] objectAtIndex:childIndex]; } -- (id)_queryValueForItem:(id)rowItem inRow:(int)rowIndex +- (id)_queryValueForItem:(id)rowItem inRow:(CPInteger)rowIndex { return [rowItem displayValue]; } diff --git a/AppKit/CPRuleEditor/CPPredicateEditorRowTemplate.j b/AppKit/CPRuleEditor/CPPredicateEditorRowTemplate.j index 21e6043f5..d34bfef58 100644 --- a/AppKit/CPRuleEditor/CPPredicateEditorRowTemplate.j +++ b/AppKit/CPRuleEditor/CPPredicateEditorRowTemplate.j @@ -702,12 +702,12 @@ CPTransformableAttributeType = 1800; return textField; } -- (void)_setOptions:(unsigned int)options +- (void)_setOptions:(unsigned)options { _predicateOptions = options; } -- (void)_setModifier:(unsigned int)modifier +- (void)_setModifier:(unsigned)modifier { _predicateModifier = modifier; } diff --git a/AppKit/CPRuleEditor/CPRuleEditor.j b/AppKit/CPRuleEditor/CPRuleEditor.j index df5733536..e5e6248eb 100644 --- a/AppKit/CPRuleEditor/CPRuleEditor.j +++ b/AppKit/CPRuleEditor/CPRuleEditor.j @@ -461,7 +461,7 @@ var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType", @param row The index of a row in the receiver. @return The currently chosen items for row @a row. */ -- (id)criteriaForRow:(int)row +- (id)criteriaForRow:(CPInteger)row { var rowcache = [self _rowCacheForIndex:row]; if (rowcache) @@ -480,7 +480,7 @@ var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType", @return The chosen values (strings, views, or menu items) for row row. @discussion The values returned are the same as those returned from the delegate method -#ruleEditor:displayValueForCriterion:inRow: */ -- (CPMutableArray)displayValuesForRow:(int)row +- (CPMutableArray)displayValuesForRow:(CPInteger)row { var rowcache = [self _rowCacheForIndex:row]; if (rowcache) @@ -503,7 +503,7 @@ var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType", @param rowIndex The index of a row in the receiver. @return The index of the parent of the row at @a rowIndex. If the row at @a rowIndex is a root row, returns @c -1. */ -- (int)parentRowForRow:(int)rowIndex +- (int)parentRowForRow:(CPInteger)rowIndex { if (rowIndex < 0 || rowIndex >= [self numberOfRows]) [CPException raise:CPRangeException reason:_cmd + @" row " + rowIndex + " is out of range"]; @@ -544,7 +544,7 @@ TODO: implement @return The type of the row at @a rowIndex. @warning Raises a @c CPRangeException if rowIndex is less than @c 0 or greater than or equal to the number of rows. */ -- (CPRuleEditorRowType)rowTypeForRow:(int)rowIndex +- (CPRuleEditorRowType)rowTypeForRow:(CPInteger)rowIndex { if (rowIndex < 0 || rowIndex > [self numberOfRows]) [CPException raise:CPRangeException reason:_cmd + @"row " + rowIndex + " is out of range"]; @@ -565,7 +565,7 @@ TODO: implement @return The immediate subrows of the row at @a rowIndex. @discussion Rows are numbered starting at @c 0. */ -- (CPIndexSet)subrowIndexesForRow:(int)rowIndex +- (CPIndexSet)subrowIndexesForRow:(CPInteger)rowIndex { var object; @@ -691,7 +691,7 @@ TODO: implement @note Currently, @a shouldAnimate has no effect, rows are always animated when calling this method. @see addRow: */ -- (void)insertRowAtIndex:(int)rowIndex withType:(unsigned int)rowType asSubrowOfRow:(int)parentRow animate:(BOOL)shouldAnimate +- (void)insertRowAtIndex:(int)rowIndex withType:(unsigned int)rowType asSubrowOfRow:(CPInteger)parentRow animate:(BOOL)shouldAnimate { /* TODO: raise exceptions if parentRow is greater than or equal to rowIndex, or if rowIndex would fall amongst the children of some other parent, or if the nesting mode forbids this configuration. @@ -1313,7 +1313,7 @@ TODO: implement return [_boundArrayOwner mutableArrayValueForKey:_boundArrayKeyPath]; } -- (BOOL)_nextUnusedItems:(CPArray)items andValues:(CPArray)values forRow:(int)rowIndex forRowType:(unsigned int)type +- (BOOL)_nextUnusedItems:(CPArray)items andValues:(CPArray)values forRow:(CPInteger)rowIndex forRowType:(unsigned int)type { var parentItem = [items lastObject], // if empty items array, this is NULL aka the root item; childrenCount = [self _queryNumberOfChildrenOfItem:parentItem withRowType:type], @@ -1375,7 +1375,7 @@ TODO: implement return YES; } -- (CPMutableArray)_getItemsAndValuesToAddForRow:(int)rowIndex ofType:(CPRuleEditorRowType)type +- (CPMutableArray)_getItemsAndValuesToAddForRow:(CPInteger)rowIndex ofType:(CPRuleEditorRowType)type { //var cachedItemsAndValues = _itemsAndValuesToAddForRowType[type]; //if (cachedItemsAndValues) @@ -1418,7 +1418,7 @@ TODO: implement [self insertRowAtIndex:insertIndex withType:type asSubrowOfRow:parentRowIndex animate:YES]; } -- (id)_insertNewRowAtIndex:(int)insertIndex ofType:(CPRuleEditorRowType)rowtype withParentRow:(int)parentRowIndex +- (id)_insertNewRowAtIndex:(int)insertIndex ofType:(CPRuleEditorRowType)rowtype withParentRow:(CPInteger)parentRowIndex { var row = [[[self rowClass] alloc] init], itemsandvalues = [self _getItemsAndValuesToAddForRow:insertIndex ofType:rowtype], @@ -1520,7 +1520,7 @@ TODO: implement } } -- (void)_changedItem:(id)fromItem toItem:(id)toItem inRow:(int)aRow atCriteriaIndex:(int)fromItemIndex +- (void)_changedItem:(id)fromItem toItem:(id)toItem inRow:(CPInteger)aRow atCriteriaIndex:(int)fromItemIndex { var criteria = [self criteriaForRow:aRow], displayValues = [self displayValuesForRow:aRow], @@ -2005,7 +2005,7 @@ TODO: implement return [_ruleDelegate ruleEditor:self child:childIndex forCriterion:item withRowType:type]; } -- (id)_queryValueForItem:(id)item inRow:(int)row +- (id)_queryValueForItem:(id)item inRow:(CPInteger)row { return [_ruleDelegate ruleEditor:self displayValueForCriterion:item inRow:row]; } @@ -2026,12 +2026,12 @@ TODO: implement _alignmentGridWidth = width; } -- (BOOL)_validateItem:(id)item value:(id)value inRow:(int)row +- (BOOL)_validateItem:(id)item value:(id)value inRow:(CPInteger)row { return [self _queryCanSelectItem:item displayValue:value inRow:row]; } -- (BOOL)_queryCanSelectItem:(id)item displayValue:(id)value inRow:(int)row +- (BOOL)_queryCanSelectItem:(id)item displayValue:(id)value inRow:(CPInteger)row { return YES; } @@ -2325,7 +2325,7 @@ TODO: implement return YES; } -- (void)_getAllAvailableItems:(id)items values:(id)values asChildrenOfItem:(id)parentItem inRow:(int)aRow +- (void)_getAllAvailableItems:(id)items values:(id)values asChildrenOfItem:(id)parentItem inRow:(CPInteger)aRow { var type, indexofCriterion, diff --git a/AppKit/CPTableColumn.j b/AppKit/CPTableColumn.j index 01c156b90..951cf45e4 100644 --- a/AppKit/CPTableColumn.j +++ b/AppKit/CPTableColumn.j @@ -416,7 +416,7 @@ CPTableColumnUserResizingMask = 1 << 1; to be invoked with row equal to -1 in cases where no actual row is involved but the table view needs to get some generic cell info. */ -- (id)dataViewForRow:(int)aRowIndex +- (id)dataViewForRow:(CPInteger)aRowIndex { return [self dataView]; } @@ -828,7 +828,7 @@ var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey", /*! @ignore */ -- (id)dataCellForRow:(int)row +- (id)dataCellForRow:(CPInteger)row { [CPException raise:CPUnsupportedMethodException reason:@"dataCellForRow: is not supported. Use -dataViewForRow:row instead."]; diff --git a/AppKit/CPTableHeaderView.j b/AppKit/CPTableHeaderView.j index 8e5e43130..d22dc4f71 100644 --- a/AppKit/CPTableHeaderView.j +++ b/AppKit/CPTableHeaderView.j @@ -287,7 +287,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal return [_tableView columnAtPoint:CGPointMake(aPoint.x, aPoint.y)]; } -- (CGRect)headerRectOfColumn:(int)aColumnIndex +- (CGRect)headerRectOfColumn:(CPInteger)aColumnIndex { var headerRect = CGRectMakeCopy([self bounds]), columnRect = [_tableView rectOfColumn:aColumnIndex]; @@ -308,7 +308,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal return _drawsColumnLines; } -- (CGRect)_cursorRectForColumn:(int)column +- (CGRect)_cursorRectForColumn:(CPInteger)column { if (column == -1 || !([_tableView._tableColumns[column] resizingMask] & CPTableColumnUserResizingMask)) return CGRectMakeZero(); @@ -417,13 +417,13 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal [CPApp setTarget:self selector:@selector(trackMouse:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES]; } -- (void)startTrackingTableColumn:(int)aColumnIndex at:(CGPoint)aPoint +- (void)startTrackingTableColumn:(CPInteger)aColumnIndex at:(CGPoint)aPoint { _lastDragDestinationColumnIndex = -1; [self _setPressedColumn:aColumnIndex]; } -- (BOOL)continueTrackingTableColumn:(int)aColumnIndex at:(CGPoint)aPoint +- (BOOL)continueTrackingTableColumn:(CPInteger)aColumnIndex at:(CGPoint)aPoint { if ([self _shouldDragTableColumn:aColumnIndex at:aPoint]) { @@ -444,19 +444,19 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal return YES; } -- (BOOL)_shouldStopTrackingTableColumn:(int)aColumnIndex at:(CGPoint)aPoint +- (BOOL)_shouldStopTrackingTableColumn:(CPInteger)aColumnIndex at:(CGPoint)aPoint { return _isTrackingColumn && _activeColumn === aColumnIndex && CGRectContainsPoint([self headerRectOfColumn:aColumnIndex], aPoint); } -- (void)stopTrackingTableColumn:(int)aColumnIndex at:(CGPoint)aPoint +- (void)stopTrackingTableColumn:(CPInteger)aColumnIndex at:(CGPoint)aPoint { [self _setPressedColumn:CPNotFound]; [self _updateResizeCursor:[CPApp currentEvent]]; } -- (BOOL)_shouldDragTableColumn:(int)aColumnIndex at:(CGPoint)aPoint +- (BOOL)_shouldDragTableColumn:(CPInteger)aColumnIndex at:(CGPoint)aPoint { return ABS(aPoint.x - _mouseDownLocation.x) >= 10.0 && [_tableView _sendDelegateShouldReorderColumn:aColumnIndex toColumn:-1]; } @@ -504,7 +504,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal [dragWindow setFrame:frame]; } -- (void)_moveColumn:(int)aFromIndex toColumn:(int)aToIndex +- (void)_moveColumn:(CPInteger)aFromIndex toColumn:(CPInteger)aToIndex { if ([_tableView _sendDelegateShouldReorderColumn:aFromIndex toColumn:aToIndex]) { @@ -581,7 +581,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal [_tableView _enqueueDraggingViews]; } -- (BOOL)shouldResizeTableColumn:(int)aColumnIndex at:(CGPoint)aPoint +- (BOOL)shouldResizeTableColumn:(CPInteger)aColumnIndex at:(CGPoint)aPoint { if (_isResizing) return YES; @@ -592,7 +592,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal return [_tableView allowsColumnResizing] && CGRectContainsPoint([self _cursorRectForColumn:aColumnIndex], aPoint); } -- (void)startResizingTableColumn:(int)aColumnIndex at:(CGPoint)aPoint +- (void)startResizingTableColumn:(CPInteger)aColumnIndex at:(CGPoint)aPoint { _isResizing = YES; @@ -602,7 +602,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal [_tableView setDisableAutomaticResizing:YES]; } -- (void)continueResizingTableColumn:(int)aColumnIndex at:(CGPoint)aPoint +- (void)continueResizingTableColumn:(CPInteger)aColumnIndex at:(CGPoint)aPoint { var tableColumn = [[_tableView tableColumns] objectAtIndex:aColumnIndex], newWidth = [tableColumn width] + aPoint.x - _previousTrackingLocation.x; @@ -622,7 +622,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal } } -- (void)stopResizingTableColumn:(int)aColumnIndex at:(CGPoint)aPoint +- (void)stopResizingTableColumn:(CPInteger)aColumnIndex at:(CGPoint)aPoint { var tableColumn = [[_tableView tableColumns] objectAtIndex:aColumnIndex]; [tableColumn _postDidResizeNotificationWithOldWidth:_columnOldWidth]; diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 29cf053ad..54d2f976a 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -453,14 +453,14 @@ Returns the number of rows in the tableview Returns the object value for each dataview. Each dataview will be sent a setObjectValue: method which will contain the object you return from this datasource method. @anchor objectValueForTable @code -- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRowIndex; +- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRowIndex; @endcode @section editing Editing: Sets the data object for an item in a given row and column. This needs to be implemented if you want inline editing support @code -- (void)tableView:(CPTableView)aTableView setObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex; +- (void)tableView:(CPTableView)aTableView setObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)rowIndex; @endcode @@ -475,9 +475,9 @@ The tableview will call this method if you click the tableheader. You should sor @note In order for the tableview to receive drops don't forget to first register the tableview for drag types like you do with every other view. Return the drag operation (move, copy, etc) that should be performed if a registered drag type is over the tableview - The data source can retarget a drop if you want by calling
-(void)setDropRow:(int)aRow dropOperation:(CPTableViewDropOperation)anOperation;
+ The data source can retarget a drop if you want by calling
-(void)setDropRow:(CPInteger)aRow dropOperation:(CPTableViewDropOperation)anOperation;
@code -- (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(CPDraggingInfo)info proposedRow:(int)row proposedDropOperation:(CPTableViewDropOperation)operation; +- (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(CPDraggingInfo)info proposedRow:(CPInteger)row proposedDropOperation:(CPTableViewDropOperation)operation; @endcode Returns YES if the drop operation is allowed otherwise NO. This method is invoked by the tableview after a drag should begin, but before it is started. If you don't want the drag to being return NO. If you want the drag to begin you should return YES and place the drag data on the pboard. @@ -487,7 +487,7 @@ Returns YES if the drop operation is allowed otherwise NO. This method is invoke Return YES if the operation was successful otherwise return NO. The data source should incorporate the data from the dragging pasteboard in this method implementation. To get this data use the draggingPasteboard method on the CPDraggingInfo object. @code -- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(CPDraggingInfo)info row:(int)row dropOperation:(CPTableViewDropOperation)operation; +- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(CPDraggingInfo)info row:(CPInteger)row dropOperation:(CPTableViewDropOperation)operation; @endcode NOT YET IMPLEMENTED @@ -1128,7 +1128,7 @@ NOT YET IMPLEMENTED @param theColumnIndex The current index of the column to move. @param theToIndex The new index for the moved column. */ -- (void)moveColumn:(int)theColumnIndex toColumn:(int)theToIndex +- (void)moveColumn:(CPInteger)theColumnIndex toColumn:(CPInteger)theToIndex { [self _moveColumn:theColumnIndex toColumn:theToIndex]; [self _autosave]; @@ -2661,12 +2661,12 @@ The autoresizingMask of the returned view will automatically be set to CPViewNot Called when the tableview is about to display a dataview @code -- (void)tableView:(CPTableView)aTableView willDisplayView:(id)aView forTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex; +- (void)tableView:(CPTableView)aTableView willDisplayView:(id)aView forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)rowIndex; @endcode Group rows are a way to separate a groups of data in a tableview. Return YES if the given row is a group row, otherwise NO. @code -- (BOOL)tableView:(CPTableView)tableView isGroupRow:(int)row; +- (BOOL)tableView:(CPTableView)tableView isGroupRow:(CPInteger)row; @endcode @@ -2674,7 +2674,7 @@ Group rows are a way to separate a groups of data in a tableview. Return YES if Return YES if the dataview at a given index and column should be edited, otherwise NO. @code -- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex; +- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)rowIndex; @endcode @@ -2682,7 +2682,7 @@ Return YES if the dataview at a given index and column should be edited, otherwi Return the height of the row at a given index. Only implement this if you want variable row heights. Otherwise use setRowHeight: on the tableview. @code -- (float)tableView:(CPTableView)tableView heightOfRow:(int)row; +- (float)tableView:(CPTableView)tableView heightOfRow:(CPInteger)row; @endcode @@ -2696,7 +2696,7 @@ Return YES if the selection of the tableview should change, otherwise NO to keep Return YES if the row at a given index should be selected, other NO to deny the selection. @code -- (BOOL)tableView:(CPTableView)aTableView shouldSelectRow:(int)rowIndex; +- (BOOL)tableView:(CPTableView)aTableView shouldSelectRow:(CPInteger)rowIndex; @endcode Return YES if the table column given should be selected, otherwise NO to deny the selection. @@ -2722,7 +2722,7 @@ Return YES if the column at a given index should move to a new column index, oth When a column is initially dragged by the user, the delegate is first called with a newColumnIndex value of -1 @code -- (BOOL)tableView:(CPTableView)tableView shouldReorderColumn:(int)columnIndex toColumn:(int)newColumnIndex; +- (BOOL)tableView:(CPTableView)tableView shouldReorderColumn:(CPInteger)columnIndex toColumn:(CPInteger)newColumnIndex; @endcode @@ -2762,7 +2762,7 @@ Notify the delegate that the user has clicked the table header of a column. Called when the user right-clicks on the tableview. -1 is passed for the row or column if the user doesn't right click on a real row or column Return a CPMenu that should be displayed if the user right-clicks. If you do not implement this the tableview will call super on menuForEvent @code -- (CPMenu)tableView:(CPTableView)aTableView menuForTableColumn:(CPTableColumn)aColumn row:(int)aRow; +- (CPMenu)tableView:(CPTableView)aTableView menuForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow; @endcode @@ -2918,7 +2918,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad /*! @ignore */ -- (void)_didClickTableColumn:(int)clickedColumn modifierFlags:(unsigned)modifierFlags +- (void)_didClickTableColumn:(CPInteger)clickedColumn modifierFlags:(unsigned)modifierFlags { [self _changeSortDescriptorsForClickOnColumn:clickedColumn]; @@ -2959,7 +2959,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad /*! @ignore */ -- (void)_changeSortDescriptorsForClickOnColumn:(int)column +- (void)_changeSortDescriptorsForClickOnColumn:(CPInteger)column { var tableColumn = [_tableColumns objectAtIndex:column], newMainSortDescriptor = [tableColumn sortDescriptorPrototype]; @@ -3139,7 +3139,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad // Copy the dataviews add them to a transparent drag view and use that drag view // to make it appear we are dragging images of those rows (as you would do in regular Cocoa) */ -- (CPView)_dragViewForColumn:(int)theColumnIndex event:(CPEvent)theDragEvent offset:(CGPoint)theDragViewOffset +- (CPView)_dragViewForColumn:(CPInteger)theColumnIndex event:(CPEvent)theDragEvent offset:(CGPoint)theDragViewOffset { var dragView = [[_CPColumnDragView alloc] initWithLineColor:[self gridColor]], tableColumn = [[self tableColumns] objectAtIndex:theColumnIndex], @@ -4767,7 +4767,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad /*! @ignore */ -- (CGRect)_rectForDropHighlightViewOnRow:(int)theRowIndex +- (CGRect)_rectForDropHighlightViewOnRow:(CPInteger)theRowIndex { if (theRowIndex >= [self numberOfRows]) theRowIndex = [self numberOfRows] - 1; @@ -4778,7 +4778,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad /*! @ignore */ -- (CGRect)_rectForDropHighlightViewBetweenUpperRow:(int)theUpperRowIndex andLowerRow:(int)theLowerRowIndex offset:(CGPoint)theOffset +- (CGRect)_rectForDropHighlightViewBetweenUpperRow:(CPInteger)theUpperRowIndex andLowerRow:(CPInteger)theLowerRowIndex offset:(CGPoint)theOffset { if (theLowerRowIndex > [self numberOfRows]) theLowerRowIndex = [self numberOfRows]; @@ -5338,7 +5338,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad Return the objectValue for the given column and row. By default return nil. */ -- (id)_sendDataSourceObjectValueForTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex +- (id)_sendDataSourceObjectValueForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex { if (!(_implementedDataSourceMethods & CPTableViewDataSource_tableView_objectValueForTableColumn_row_)) return nil; @@ -5350,7 +5350,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @ignore Call the method tableView:setObjectValue:ForTableColum:row: of the dataSource */ -- (void)_sendDataSourceSetObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex +- (void)_sendDataSourceSetObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex { if (!(_implementedDataSourceMethods & CPTableViewDataSource_tableView_setObjectValue_forTableColumn_row_)) return; @@ -5374,7 +5374,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @ignore Return if the drop is accepted or not for the given dropOperation, info and row. By default return NO. */ -- (BOOL)_sendDataSourceAcceptDrop:(id)info row:(int)aRowIndex dropOperation:(CPTableViewDropOperation)operation +- (BOOL)_sendDataSourceAcceptDrop:(id)info row:(CPInteger)aRowIndex dropOperation:(CPTableViewDropOperation)operation { if (!(_implementedDataSourceMethods & CPTableViewDataSource_tableView_acceptDrop_row_dropOperation_)) return NO; @@ -5386,7 +5386,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @ignore Return the dragOperation for the given row and dropOperation. By default return CPDragOperationNone. */ -- (CPDragOperation)_sendDataSourceValidateDrop:(id)info proposedRow:(int)aRowIndex proposedDropOperation:(CPTableViewDropOperation)operation +- (CPDragOperation)_sendDataSourceValidateDrop:(id)info proposedRow:(CPInteger)aRowIndex proposedDropOperation:(CPTableViewDropOperation)operation { if (!(_implementedDataSourceMethods & CPTableViewDataSource_tableView_validateDrop_proposedRow_proposedDropOperation_)) return CPDragOperationNone; @@ -5494,7 +5494,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @ignore Call the delegate didClickTableColumn with the given tableColumn */ -- (void)_sendDelegateDidClickTableColumn:(int)column +- (void)_sendDelegateDidClickTableColumn:(CPInteger)column { if (_implementedDelegateMethods & CPTableViewDelegate_tableView_didClickTableColumn_) [_delegate tableView:self didClickTableColumn:_tableColumns[column]]; @@ -5504,7 +5504,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @ignore Call the delegate didDragTableColumn with the given tableColumn */ -- (void)_sendDelegateDidDragTableColumn:(int)column +- (void)_sendDelegateDidDragTableColumn:(CPInteger)column { if (_implementedDelegateMethods & CPTableViewDelegate_tableView_didDragTableColumn_) [_delegate tableView:self didDragTableColumn:_tableColumns[column]]; @@ -5514,7 +5514,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @ignore Call the delegate mouseDownInHeaderOfTableColumn with the given tableColumn */ -- (void)_sendDelegateMouseDownInHeaderOfTableColumn:(int)column +- (void)_sendDelegateMouseDownInHeaderOfTableColumn:(CPInteger)column { if (_implementedDelegateMethods & CPTableViewDelegate_tableView_mouseDownInHeaderOfTableColumn_) [_delegate tableView:self mouseDownInHeaderOfTableColumn:_tableColumns[column]]; @@ -5551,7 +5551,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @ignore Return if the given row is a group or not. By default return NO. */ -- (BOOL)_sendDelegateIsGroupRow:(int)anIndex +- (BOOL)_sendDelegateIsGroupRow:(CPInteger)anIndex { if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_isGroupRow_)) return NO; @@ -5563,7 +5563,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @ignore Return is we should select the given row. By Default return YES */ -- (BOOL)_sendDelegateShouldSelectRow:(int)anIndex +- (BOOL)_sendDelegateShouldSelectRow:(CPInteger)anIndex { if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_shouldSelectRow_)) return YES; @@ -5575,7 +5575,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @ignore Call the delegate tableView:willDisplayView:forTableColumn:row: */ -- (void)_sendDelegateWillDisplayView:(id)aCell forTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex +- (void)_sendDelegateWillDisplayView:(id)aCell forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex { if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_willDisplayView_forTableColumn_row_)) return; @@ -5601,7 +5601,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad It can be possible if column reordering is allowed and if the tableview delegate also accept the reordering */ -- (BOOL)_sendDelegateShouldReorderColumn:(int)columnIndex toColumn:(int)newColumnIndex +- (BOOL)_sendDelegateShouldReorderColumn:(CPInteger)columnIndex toColumn:(CPInteger)newColumnIndex { if ([self allowsColumnReordering] && _implementedDelegateMethods & CPTableViewDelegate_tableView_shouldReorderColumn_toColumn_) @@ -5616,7 +5616,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @ignore Return the height of the given row. By default return [self rowHeight]. */ -- (float)_sendDelegateHeightOfRow:(int)anIndex +- (float)_sendDelegateHeightOfRow:(CPInteger)anIndex { if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_heightOfRow_)) return [self rowHeight]; @@ -5628,7 +5628,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @ignore Return a boolean to know if we should or not edit the given row. By default return YES. */ -- (BOOL)_sendDelegateShouldEditTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex +- (BOOL)_sendDelegateShouldEditTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex { if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_shouldEditTableColumn_row_)) return YES; @@ -5652,7 +5652,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @ignore Return a view for the given tableColumn and row. By default return nil. */ -- (CPView)_sendDelegateViewForTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex +- (CPView)_sendDelegateViewForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex { if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_viewForTableColumn_row_)) return nil; @@ -5664,7 +5664,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @ignore Return a view for the given tableColumn and row. By default return nil. */ -- (CPView)_sendDelegateDataViewForTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex +- (CPView)_sendDelegateDataViewForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex { if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_dataViewForTableColumn_row_)) return nil; @@ -5692,7 +5692,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @ignore Not yet implemented */ -- (CPString)_sendDelegateToolTipForView:(id)aView rect:(CGRect)aRect tableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex mouseLocation:(CGPoint)aPoint +- (CPString)_sendDelegateToolTipForView:(id)aView rect:(CGRect)aRect tableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex mouseLocation:(CGPoint)aPoint { if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_toolTipForView_rect_tableColumn_row_mouseLocation_)) return nil; @@ -5704,7 +5704,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @ignore Not yet implemented */ -- (BOOL)_sendDelegateShouldTrackView:(id)aView forTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex +- (BOOL)_sendDelegateShouldTrackView:(id)aView forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex { if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_shouldTrackView_forTableColumn_row_)) return YES; @@ -5716,7 +5716,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @ignore Not yet implemented */ -- (BOOL)_sendDelegateShouldShowViewExpansionForTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex +- (BOOL)_sendDelegateShouldShowViewExpansionForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex { if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_shouldShowViewExpansionForTableColumn_row_)) return YES; @@ -5740,7 +5740,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @ignore Not yet implemented */ -- (CPString)_sendDelegateTypeSelectStringForTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex +- (CPString)_sendDelegateTypeSelectStringForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex { if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_typeSelectStringForTableColumn_row_)) return nil; @@ -5752,7 +5752,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad @ignore Not yet implemented ! */ -- (int)_sendDelegateNextTypeSelectMatchFromRow:(int)aRowIndex toRow:(int)aSecondRowIndex forString:(CPString)aString +- (int)_sendDelegateNextTypeSelectMatchFromRow:(CPInteger)aRowIndex toRow:(CPInteger)aSecondRowIndex forString:(CPString)aString { if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_nextTypeSelectMatchFromRow_toRow_forString_)) return -1; diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j index ff837bca7..ba023101b 100644 --- a/AppKit/CPTextField.j +++ b/AppKit/CPTextField.j @@ -1765,7 +1765,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); [self _becomeFirstKeyResponder]; } -- (BOOL)validateUserInterfaceItem:(id )anItem +- (BOOL)validateUserInterfaceItem:(id /**/)anItem { var theAction = [anItem action]; diff --git a/AppKit/CPToolbar.j b/AppKit/CPToolbar.j index 86ee9d721..bdf7214da 100644 --- a/AppKit/CPToolbar.j +++ b/AppKit/CPToolbar.j @@ -93,7 +93,7 @@ var CPToolbarsByIdentifier = nil, BOOL _showsBaselineSeparator; BOOL _allowsUserCustomization; BOOL _isVisible; - int _sizeMode @accessors(property=sizeMode); + CPToolbarSizeMode _sizeMode @accessors(property=sizeMode); int _desiredHeight; id _delegate; diff --git a/AppKit/_CPAutocompleteMenu.j b/AppKit/_CPAutocompleteMenu.j index 745aef571..5dc6121f9 100644 --- a/AppKit/_CPAutocompleteMenu.j +++ b/AppKit/_CPAutocompleteMenu.j @@ -268,7 +268,7 @@ var _CPAutocompleteMenuMaximumHeight = 307; return [contentArray count]; } -- (void)tableView:(CPTableView)tableView objectValueForTableColumn:(CPTableColumn)tableColumn row:(int)row +- (void)tableView:(CPTableView)tableView objectValueForTableColumn:(CPTableColumn)tableColumn row:(CPInteger)row { return [contentArray objectAtIndex:row]; } diff --git a/AppKit/_CPPopUpList.j b/AppKit/_CPPopUpList.j index a9db03563..b6e400ff0 100644 --- a/AppKit/_CPPopUpList.j +++ b/AppKit/_CPPopUpList.j @@ -416,7 +416,7 @@ var ListColumnIdentifier = @"1"; /*! Selects a row and scrolls it to be visible. Returns YES if the selection actually changed. */ -- (BOOL)selectRow:(int)row +- (BOOL)selectRow:(CPInteger)row { if (row === [_tableView selectedRow]) return NO; @@ -794,7 +794,7 @@ var _CPPopUpListDataSourceKey = @"_CPPopUpListDataSourceKey", return MAX([_dataSource numberOfItemsInList:self], 1); } -- (id)tableView:(id)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRow +- (id)tableView:(id)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow { return [_dataSource list:self displayValueForObjectValue:[_dataSource list:self objectValueForItemAtIndex:aRow]]; } diff --git a/Tests/AppKit/CPKeyValueBindingTest.j b/Tests/AppKit/CPKeyValueBindingTest.j index 3d8e65ce2..2b03ff655 100644 --- a/Tests/AppKit/CPKeyValueBindingTest.j +++ b/Tests/AppKit/CPKeyValueBindingTest.j @@ -368,7 +368,7 @@ id lastKey; } -- (void)setValue:value forKey:aKey +- (void)setValue:(id)value forKey:(CPString)aKey { lastValue = value; lastKey = aKey; diff --git a/Tests/AppKit/CPTableViewTest.j b/Tests/AppKit/CPTableViewTest.j index a103507dd..74a0ecc4f 100644 --- a/Tests/AppKit/CPTableViewTest.j +++ b/Tests/AppKit/CPTableViewTest.j @@ -327,12 +327,12 @@ return [tableEntries count]; } -- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRow +- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow { return tableEntries[aRow]; } -- (void)tableView:(CPTableView)aTableView setObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(int)aRow +- (void)tableView:(CPTableView)aTableView setObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRow { tableEntries[aRow] = anObject; } @@ -343,7 +343,7 @@ { } -- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aTableColumn row:(int)anRow +- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)anRow { return YES; } @@ -357,7 +357,7 @@ CPTableViewTest tester @accessors; } -- (void)tableView:(CPTableView)aTableView willDisplayView:(CPView)aView forTableColumn:(CPTableColumn)tableColumn row:(int)row +- (void)tableView:(CPTableView)aTableView willDisplayView:(CPView)aView forTableColumn:(CPTableColumn)tableColumn row:(CPInteger)row { // Make sure each view contains the full row in its objectValue [tester assert:tableEntries[row] equals:[aView objectValue]]; diff --git a/Tests/AppKit/CPTextFieldTest.j b/Tests/AppKit/CPTextFieldTest.j index 19dc3c539..bca749b45 100644 --- a/Tests/AppKit/CPTextFieldTest.j +++ b/Tests/AppKit/CPTextFieldTest.j @@ -54,7 +54,7 @@ } -- (id)initWithFrame:aFrame +- (id)initWithFrame:(CGRect)aFrame { if (self = [super initWithFrame:aFrame]) { diff --git a/Tests/AppKit/WithAndWithoutBindingsIntegration/01_WithoutBindings/TableViewDataSource.j b/Tests/AppKit/WithAndWithoutBindingsIntegration/01_WithoutBindings/TableViewDataSource.j index 24a9f8387..ffe7727d5 100644 --- a/Tests/AppKit/WithAndWithoutBindingsIntegration/01_WithoutBindings/TableViewDataSource.j +++ b/Tests/AppKit/WithAndWithoutBindingsIntegration/01_WithoutBindings/TableViewDataSource.j @@ -32,7 +32,7 @@ return [collection count]; } -- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex +- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)rowIndex { var objectAtRow = [collection objectAtIndex:rowIndex], columnKey = [aTableColumn identifier]; @@ -40,7 +40,7 @@ return [objectAtRow valueForKey:columnKey]; } -- (void)tableView:(CPTableView)aTableView setObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex +- (void)tableView:(CPTableView)aTableView setObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)rowIndex { var objectAtRow = [collection objectAtIndex:rowIndex], columnKey = [aTableColumn identifier]; @@ -56,8 +56,8 @@ // TODO Drag and drop is not implemented since it's difficult to test in a unit test and not all that relevant in a bindings context anyhow. // - (BOOL)tableView:(CPTableView)aTableView writeRowsWithIndexes:(CPIndexSet)rowIndexes toPasteboard:(CPPasteboard)pboard -// - (CPDragOperation)tableView:(CPTableView)tv validateDrop:(id)info proposedRow:(int)row proposedDropOperation:(CPTableViewDropOperation)op -// - (BOOL)tableView:(CPTableView)tv acceptDrop:(id)info row:(int)row dropOperation:(CPTableViewDropOperation)op +// - (CPDragOperation)tableView:(CPTableView)tv validateDrop:(id)info proposedRow:(CPInteger)row proposedDropOperation:(CPTableViewDropOperation)op +// - (BOOL)tableView:(CPTableView)tv acceptDrop:(id)info row:(CPInteger)row dropOperation:(CPTableViewDropOperation)op // - (void)awakeFromNib @end diff --git a/Tests/AppKit/WithAndWithoutBindingsIntegration/02_WithBindings/TableViewDataSource.j b/Tests/AppKit/WithAndWithoutBindingsIntegration/02_WithBindings/TableViewDataSource.j index dbf4844da..ecd06daf6 100644 --- a/Tests/AppKit/WithAndWithoutBindingsIntegration/02_WithBindings/TableViewDataSource.j +++ b/Tests/AppKit/WithAndWithoutBindingsIntegration/02_WithBindings/TableViewDataSource.j @@ -36,8 +36,8 @@ // TODO Drag and drop is not implemented since it's difficult to test in a unit test and not all that relevant in a bindings context anyhow. // - (BOOL)tableView:(CPTableView)aTableView writeRowsWithIndexes:(CPIndexSet)rowIndexes toPasteboard:(CPPasteboard)pboard -// - (CPDragOperation)tableView:(CPTableView)tv validateDrop:(id)info proposedRow:(int)row proposedDropOperation:(CPTableViewDropOperation)op -// - (BOOL)tableView:(CPTableView)tv acceptDrop:(id)info row:(int)row dropOperation:(CPTableViewDropOperation)op +// - (CPDragOperation)tableView:(CPTableView)tv validateDrop:(id)info proposedRow:(CPInteger)row proposedDropOperation:(CPTableViewDropOperation)op +// - (BOOL)tableView:(CPTableView)tv acceptDrop:(id)info row:(CPInteger)row dropOperation:(CPTableViewDropOperation)op // - (void)awakeFromNib @end diff --git a/Tests/Foundation/CPOperationQueueTest.j b/Tests/Foundation/CPOperationQueueTest.j index c0f73d7b3..0cc5de666 100644 --- a/Tests/Foundation/CPOperationQueueTest.j +++ b/Tests/Foundation/CPOperationQueueTest.j @@ -33,7 +33,7 @@ globalResults = []; - (void)observeValueForKeyPath:(CPString)keyPath ofObject:(id)object change:(CPDictionary)change - context:(void)context + context:(id)context { [changedKeyPaths addObject:keyPath]; } diff --git a/Tests/Foundation/CPOperationTest.j b/Tests/Foundation/CPOperationTest.j index 701ef8397..1c1beef56 100644 --- a/Tests/Foundation/CPOperationTest.j +++ b/Tests/Foundation/CPOperationTest.j @@ -31,7 +31,7 @@ - (void)observeValueForKeyPath:(CPString)keyPath ofObject:(id)object change:(CPDictionary)change - context:(void)context + context:(id)context { [changedKeyPaths addObject:keyPath]; } diff --git a/Tests/Manual/ArrayController1/AppController.j b/Tests/Manual/ArrayController1/AppController.j index ff54b1544..78161119e 100644 --- a/Tests/Manual/ArrayController1/AppController.j +++ b/Tests/Manual/ArrayController1/AppController.j @@ -75,13 +75,13 @@ CPLogRegister(CPLogConsole); return [itemsArray count]; } -- (id)tableView:(CPTableView)tableView objectValueForTableColumn:(CPTableColumn)tableColumn row:(int)row +- (id)tableView:(CPTableView)tableView objectValueForTableColumn:(CPTableColumn)tableColumn row:(CPInteger)row { return "foo"; } */ -- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex +- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)rowIndex { return YES; } diff --git a/Tests/Manual/CPBrowserTest/AppController.j b/Tests/Manual/CPBrowserTest/AppController.j index c30d847a9..7c8c04f50 100644 --- a/Tests/Manual/CPBrowserTest/AppController.j +++ b/Tests/Manual/CPBrowserTest/AppController.j @@ -77,7 +77,7 @@ //[browser setAllowsMultipleSelection:NO]; } -- (BOOL)browser:(CPBrowser)aBrowser writeRowsWithIndexes:(CPIndexSet)indexes inColumn:(int)column toPasteboard:(CPPasteboard)pboard +- (BOOL)browser:(CPBrowser)aBrowser writeRowsWithIndexes:(CPIndexSet)indexes inColumn:(CPInteger)column toPasteboard:(CPPasteboard)pboard { var encodedData = [CPKeyedArchiver archivedDataWithRootObject:"Foo"]; [pboard declareTypes:["Type"] owner:self]; @@ -85,11 +85,11 @@ return YES; } -- (BOOL)browser:(id)aBrowser validateDrop:(id)info proposedRow:(int)row column:(int)column dropOperation:(id)op +- (BOOL)browser:(id)aBrowser validateDrop:(id)info proposedRow:(CPInteger)row column:(CPInteger)column dropOperation:(id)op { return CPDragOperationMove; } -- (BOOL)browser:(id)aBrowser acceptDrop:(id)info atRow:(int)row column:(int)column dropOperation:(id)op +- (BOOL)browser:(id)aBrowser acceptDrop:(id)info atRow:(CPInteger)row column:(CPInteger)column dropOperation:(id)op { return YES; } diff --git a/Tests/Manual/CPDictionaryControllerTest/AppController.j b/Tests/Manual/CPDictionaryControllerTest/AppController.j index 244a8e76b..c733154d6 100644 --- a/Tests/Manual/CPDictionaryControllerTest/AppController.j +++ b/Tests/Manual/CPDictionaryControllerTest/AppController.j @@ -54,7 +54,7 @@ [tableView setNeedsDisplay:YES]; } -- (BOOL)tableView:(CPTableView)tableView isGroupRow:(int)row +- (BOOL)tableView:(CPTableView)tableView isGroupRow:(CPInteger)row { return (row > 2 && row < 5); } diff --git a/Tests/Manual/CPRuleEditorCibTest/RuleDelegate.j b/Tests/Manual/CPRuleEditorCibTest/RuleDelegate.j index 3573e9822..b1caa79bd 100644 --- a/Tests/Manual/CPRuleEditorCibTest/RuleDelegate.j +++ b/Tests/Manual/CPRuleEditorCibTest/RuleDelegate.j @@ -78,7 +78,7 @@ var CPRuleEditorCustomControlClass = @"CPRuleEditorCustomControlClass"; (1) CPMenuItem: not implemented yet. */ -- (id)ruleEditor:(CPRuleEditor)editor displayValueForCriterion:(id)criterion inRow:(int)row +- (id)ruleEditor:(CPRuleEditor)editor displayValueForCriterion:(id)criterion inRow:(CPInteger)row { var custom_control_class = [criterion objectForKey:CPRuleEditorCustomControlClass]; @@ -98,7 +98,7 @@ var CPRuleEditorCustomControlClass = @"CPRuleEditorCustomControlClass"; return [criterion objectForKey:@"valeur"]; } -- (CPDictionary)ruleEditor:(CPRuleEditor)editor predicatePartsForCriterion:(id)criterion withDisplayValue:(id)value inRow:(int)row +- (CPDictionary)ruleEditor:(CPRuleEditor)editor predicatePartsForCriterion:(id)criterion withDisplayValue:(id)value inRow:(CPInteger)row { var predicatePartsForCriterion = @{}; diff --git a/Tests/Manual/CPTableViewGroupRows/AppController.j b/Tests/Manual/CPTableViewGroupRows/AppController.j index bf80fb336..9518e2c2e 100644 --- a/Tests/Manual/CPTableViewGroupRows/AppController.j +++ b/Tests/Manual/CPTableViewGroupRows/AppController.j @@ -47,14 +47,14 @@ return [dataSource count]; } -- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex +- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)rowIndex { return dataSource[rowIndex]; } -- (BOOL)tableView:(CPTableView)aTableView isGroupRow:(int)rowIndex +- (BOOL)tableView:(CPTableView)aTableView isGroupRow:(CPInteger)rowIndex { return rowIndex == 5; } -@end \ No newline at end of file +@end diff --git a/Tests/Manual/FontEnhancementTest/AppController.j b/Tests/Manual/FontEnhancementTest/AppController.j index 6eff78438..1dd3b1b86 100644 --- a/Tests/Manual/FontEnhancementTest/AppController.j +++ b/Tests/Manual/FontEnhancementTest/AppController.j @@ -51,7 +51,7 @@ var fontLabelField = nil, return 7; } -- (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRow +- (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow { return ["one", "two", "three"][parseInt([aColumn identifier], 10)]; } diff --git a/Tests/Manual/LongBindings/AppController.j b/Tests/Manual/LongBindings/AppController.j index 7f90da839..90330e054 100644 --- a/Tests/Manual/LongBindings/AppController.j +++ b/Tests/Manual/LongBindings/AppController.j @@ -55,7 +55,7 @@ // return [[[self ordersArrayController] arrangedObjects] count]; // } // -// - (id)tableView:(CPTableView)theTableView objectValueForTableColumn:(CPTableColumn)theColumn row:(int)theRow +// - (id)tableView:(CPTableView)theTableView objectValueForTableColumn:(CPTableColumn)theColumn row:(CPInteger)theRow // { // var order = [[[self ordersArrayController] arrangedObjects] objectAtIndex:theRow]; // return [[order customer] valueForKey:[theColumn identifier]]; diff --git a/Tests/Manual/NSBrowserTest/AppController.j b/Tests/Manual/NSBrowserTest/AppController.j index 67e5cd1a0..b972039be 100644 --- a/Tests/Manual/NSBrowserTest/AppController.j +++ b/Tests/Manual/NSBrowserTest/AppController.j @@ -77,7 +77,7 @@ // [theWindow setFullPlatformWindow:YES]; } -- (BOOL)browser:(CPBrowser)aBrowser writeRowsWithIndexes:(CPIndexSet)indexes inColumn:(int)column toPasteboard:(CPPasteboard)pboard +- (BOOL)browser:(CPBrowser)aBrowser writeRowsWithIndexes:(CPIndexSet)indexes inColumn:(CPInteger)column toPasteboard:(CPPasteboard)pboard { var encodedData = [CPKeyedArchiver archivedDataWithRootObject:"Foo"]; [pboard declareTypes:["Type"] owner:self]; @@ -85,11 +85,11 @@ return YES; } -- (BOOL)browser:(id)aBrowser validateDrop:(id)info proposedRow:(int)row column:(int)column dropOperation:(id)op +- (BOOL)browser:(id)aBrowser validateDrop:(id)info proposedRow:(CPInteger)row column:(CPInteger)column dropOperation:(id)op { return CPDragOperationMove; } -- (BOOL)browser:(id)aBrowser acceptDrop:(id)info atRow:(int)row column:(int)column dropOperation:(id)op +- (BOOL)browser:(id)aBrowser acceptDrop:(id)info atRow:(CPInteger)row column:(CPInteger)column dropOperation:(id)op { return YES; } diff --git a/Tests/Manual/NewTextFieldBezel/AppController.j b/Tests/Manual/NewTextFieldBezel/AppController.j index fb92db10c..c0f020a80 100644 --- a/Tests/Manual/NewTextFieldBezel/AppController.j +++ b/Tests/Manual/NewTextFieldBezel/AppController.j @@ -108,12 +108,12 @@ return 7; } -- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)column row:(int)row +- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)column row:(CPInteger)row { return "Double-click to edit"; } -- (void)tableView:(CPTableView)aTableView setObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex +- (void)tableView:(CPTableView)aTableView setObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)rowIndex { } diff --git a/Tests/Manual/SmartFoldersDemo/BadgedOutlineView.j b/Tests/Manual/SmartFoldersDemo/BadgedOutlineView.j index d8c244bd5..69fd91f91 100644 --- a/Tests/Manual/SmartFoldersDemo/BadgedOutlineView.j +++ b/Tests/Manual/SmartFoldersDemo/BadgedOutlineView.j @@ -198,7 +198,7 @@ var CPSourceListDataSource_sourceList_itemHasBadge_ = 1 << 1, @implementation CPOutlineView (MyExtensions) -- (CPView)preparedViewAtColumn:(int)column row:(int)row +- (CPView)preparedViewAtColumn:(CPInteger)column row:(CPInteger)row { return [self _newDataViewForRow:row tableColumn:_tableColumns[column]]; } diff --git a/Tests/Manual/TableTest/BorderTableTest/AppController.j b/Tests/Manual/TableTest/BorderTableTest/AppController.j index 942d5cdb5..62bd97497 100644 --- a/Tests/Manual/TableTest/BorderTableTest/AppController.j +++ b/Tests/Manual/TableTest/BorderTableTest/AppController.j @@ -42,7 +42,7 @@ CPLogRegister(CPLogConsole); return 10; } -- (id)tableView:(CPTableView)tableView objectValueForTableColumn:(CPTableColumn)tableColumn row:(int)row +- (id)tableView:(CPTableView)tableView objectValueForTableColumn:(CPTableColumn)tableColumn row:(CPInteger)row { return String((row + 1) * [[tableColumn identifier] intValue]); } diff --git a/Tests/Manual/TableTest/ColumnResize/AppController.j b/Tests/Manual/TableTest/ColumnResize/AppController.j index e0a4a1f68..539dc8993 100644 --- a/Tests/Manual/TableTest/ColumnResize/AppController.j +++ b/Tests/Manual/TableTest/ColumnResize/AppController.j @@ -83,12 +83,12 @@ return 2000; } -- (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRow +- (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow { return "Column " + [aColumn identifier] + " Row " + aRow; } -- (int)tableView:(CPTableView)aTableView heightOfRow:(int)aRow +- (int)tableView:(CPTableView)aTableView heightOfRow:(CPInteger)aRow { return aRow % 2 ? 200 : 50; return aRow % 2 ? 1010 - (aRow * 10) : 10 + (aRow * 10); diff --git a/Tests/Manual/TableTest/ColumnSizing2/AppController.j b/Tests/Manual/TableTest/ColumnSizing2/AppController.j index e3cf7d71e..682b9dfdb 100644 --- a/Tests/Manual/TableTest/ColumnSizing2/AppController.j +++ b/Tests/Manual/TableTest/ColumnSizing2/AppController.j @@ -97,7 +97,7 @@ HEIGHT = 600; return tableView._meta['x'] + tableView._meta['y'] * 2; } -- (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRow +- (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow { return "Column " + [aColumn identifier] + " Row " + aRow; } diff --git a/Tests/Manual/TableTest/DataView/AppController.j b/Tests/Manual/TableTest/DataView/AppController.j index cca6789ae..9ab88c35b 100644 --- a/Tests/Manual/TableTest/DataView/AppController.j +++ b/Tests/Manual/TableTest/DataView/AppController.j @@ -83,7 +83,7 @@ var AppControllerInstance = nil; } // Don't allow files to be selected during an upload -- (BOOL)tableView:(CPTableView)aTableView shouldSelectRow:(int)index +- (BOOL)tableView:(CPTableView)aTableView shouldSelectRow:(CPInteger)index { return !uploading; } diff --git a/Tests/Manual/TableTest/DelegateSelectionTest/AppController.j b/Tests/Manual/TableTest/DelegateSelectionTest/AppController.j index d6fe55675..90698ddd0 100755 --- a/Tests/Manual/TableTest/DelegateSelectionTest/AppController.j +++ b/Tests/Manual/TableTest/DelegateSelectionTest/AppController.j @@ -46,7 +46,7 @@ return [_names count]; } -- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRowIndex +- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRowIndex { return _names[aRowIndex]; } @@ -62,7 +62,7 @@ return YES; } -- (BOOL)tableView:(CPTableView)aTableView shouldSelectRow:(int)rowIndex +- (BOOL)tableView:(CPTableView)aTableView shouldSelectRow:(CPInteger)rowIndex { console.log(@"shouldSelectRow"); return YES; @@ -115,7 +115,7 @@ return YES; } -- (BOOL)tableView:(CPTableView)aTableView shouldSelectRow:(int)rowIndex +- (BOOL)tableView:(CPTableView)aTableView shouldSelectRow:(CPInteger)rowIndex { console.log(@"shouldSelectRow"); return YES; diff --git a/Tests/Manual/TableTest/DragAndDrop/AppController.j b/Tests/Manual/TableTest/DragAndDrop/AppController.j index 0cc82401b..56464a735 100644 --- a/Tests/Manual/TableTest/DragAndDrop/AppController.j +++ b/Tests/Manual/TableTest/DragAndDrop/AppController.j @@ -99,7 +99,7 @@ TableTestDragAndDropTableViewDataType = @"TableTestDragAndDropTableViewDataType" return [rowList count]; } -- (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRow +- (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow { if ([aColumn identifier] == "Row") return aRow; @@ -118,13 +118,13 @@ TableTestDragAndDropTableViewDataType = @"TableTestDragAndDropTableViewDataType" return YES; } -- (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(id)info proposedRow:(int)row proposedDropOperation:(CPTableViewDropOperation)operation +- (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(id)info proposedRow:(CPInteger)row proposedDropOperation:(CPTableViewDropOperation)operation { [aTableView setDropRow:row dropOperation:CPTableViewDropAbove]; return CPDragOperationMove; } -- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id)info row:(int)row dropOperation:(CPTableViewDropOperation)operation +- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id)info row:(CPInteger)row dropOperation:(CPTableViewDropOperation)operation { var pasteboard = [info draggingPasteboard], encodedData = [pasteboard dataForType:TableTestDragAndDropTableViewDataType], diff --git a/Tests/Manual/TableTest/DrawRowTest/AppController.j b/Tests/Manual/TableTest/DrawRowTest/AppController.j index e40fc6045..e4d09bc80 100644 --- a/Tests/Manual/TableTest/DrawRowTest/AppController.j +++ b/Tests/Manual/TableTest/DrawRowTest/AppController.j @@ -66,7 +66,7 @@ return 10000; } -- (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRow +- (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow { return "Column " + [aColumn identifier] + " Row " + aRow; } diff --git a/Tests/Manual/TableTest/Editing/AppController.j b/Tests/Manual/TableTest/Editing/AppController.j index c811385b8..f96f3d6e4 100644 --- a/Tests/Manual/TableTest/Editing/AppController.j +++ b/Tests/Manual/TableTest/Editing/AppController.j @@ -86,7 +86,7 @@ return numberOfRows; } -- (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRow +- (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow { if ([aColumn identifier] == "Row") return aRow; @@ -102,7 +102,7 @@ } } -- (void)tableView:(CPTableView)tableView setObjectValue:(id)aValue forTableColumn:(CPTableColumn)tableColumn row:(int)aRow +- (void)tableView:(CPTableView)tableView setObjectValue:(id)aValue forTableColumn:(CPTableColumn)tableColumn row:(CPInteger)aRow { var name = [tableColumn identifier]; diff --git a/Tests/Manual/TableTest/EditingControls/AppController.j b/Tests/Manual/TableTest/EditingControls/AppController.j index 451d4ba94..05fdbbba6 100644 --- a/Tests/Manual/TableTest/EditingControls/AppController.j +++ b/Tests/Manual/TableTest/EditingControls/AppController.j @@ -24,7 +24,7 @@ [CPDictionary dictionaryWithObjects:[YES, NO, @"NO"] forKeys:keys], [CPDictionary dictionaryWithObjects:[NO, YES, @"YES"] forKeys:keys] ]]; - + [self _selectSegment:0]; [theWindow setFullPlatformWindow:YES]; } @@ -37,14 +37,14 @@ - (void)_selectSegment:(CPInteger)anIndex { var EnumerateColumns; - + if (anIndex == 0) { EnumerateColumns = function(column, idx) { [column bind:CPValueBinding toObject:arrayController withKeyPath:(@"arrangedObjects." + [column identifier]) options:nil]; }; - + [tableView setDataSource:nil]; } else @@ -53,10 +53,10 @@ { [column unbind:CPValueBinding]; }; - + [tableView setDataSource:self]; } - + [[tableView tableColumns] enumerateObjectsUsingBlock:EnumerateColumns]; } @@ -70,12 +70,12 @@ return [content count]; } -- (id)tableView:(id)aTableView objectValueForTableColumn:(CPTableColumn)aTableColumn row:(int)aRow +- (id)tableView:(id)aTableView objectValueForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRow { return [[content objectAtIndex:aRow] objectForKey:[aTableColumn identifier]]; } -- (void)tableView:(CPTableView)aTableView setObjectValue:(id)aValue forTableColumn:(CPTableColumn)aTableColumn row:(int)aRow +- (void)tableView:(CPTableView)aTableView setObjectValue:(id)aValue forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRow { [[content objectAtIndex:aRow] setObject:aValue forKey:[aTableColumn identifier]]; } diff --git a/Tests/Manual/TableTest/GroupRowTest/AppController.j b/Tests/Manual/TableTest/GroupRowTest/AppController.j index 28a2111ca..e2fbff4c5 100644 --- a/Tests/Manual/TableTest/GroupRowTest/AppController.j +++ b/Tests/Manual/TableTest/GroupRowTest/AppController.j @@ -105,7 +105,7 @@ return 500; } -- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRow +- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow { if ([aColumn identifier] === "icons") return iconImage; @@ -113,7 +113,7 @@ return aRow; } -- (BOOL)tableView:(CPTableView)aTableView isGroupRow:(int)aRow +- (BOOL)tableView:(CPTableView)aTableView isGroupRow:(CPInteger)aRow { var groups = []; diff --git a/Tests/Manual/TableTest/OldTest/AppController.j b/Tests/Manual/TableTest/OldTest/AppController.j index 1ca284229..d28b73b64 100644 --- a/Tests/Manual/TableTest/OldTest/AppController.j +++ b/Tests/Manual/TableTest/OldTest/AppController.j @@ -287,7 +287,7 @@ tableTestDragType = @"CPTableViewTestDragType"; return dataSet3.length; } -- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRow +- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow { if ([aColumn identifier] === "icons") return iconImage; @@ -310,7 +310,7 @@ tableTestDragType = @"CPTableViewTestDragType"; [aTableView reloadData]; } -- (BOOL)tableView:(CPTableView)aTableView shouldSelectRow:(int)rowIndex +- (BOOL)tableView:(CPTableView)aTableView shouldSelectRow:(CPInteger)rowIndex { CPLog.debug(@"tableView:shouldSelectRow"); return true; @@ -337,7 +337,7 @@ tableTestDragType = @"CPTableViewTestDragType"; CPLogConsole(_cmd + [notification description]); } -- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)tableColumn row:(int)row +- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)tableColumn row:(CPInteger)row { if (aTableView === tableView3) return YES; @@ -345,12 +345,12 @@ tableTestDragType = @"CPTableViewTestDragType"; return NO; } -- (void)tableView:(CPTableView)aTableView willDisplayView:(CPView)aView forTableColumn:(CPTableColumn)tableColumn row:(int)row +- (void)tableView:(CPTableView)aTableView willDisplayView:(CPView)aView forTableColumn:(CPTableColumn)tableColumn row:(CPInteger)row { //CPLogConsole(_cmd + " column: " + [tableColumn identifier] + " row:" + row) } -- (void)tableView:(CPTableView)aTableView setObjectValue:(id)aValue forTableColumn:(CPTableColumn)tableColumn row:(int)row +- (void)tableView:(CPTableView)aTableView setObjectValue:(id)aValue forTableColumn:(CPTableColumn)tableColumn row:(CPInteger)row { if (aTableView === tableView3) dataSet3[row] = aValue; @@ -396,7 +396,7 @@ tableTestDragType = @"CPTableViewTestDragType"; return CPDragOperationMove; } -- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id)info row:(int)row dropOperation:(CPTableViewDropOperation)operation +- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id)info row:(CPInteger)row dropOperation:(CPTableViewDropOperation)operation { var pboard = [info draggingPasteboard], rowData = [pboard dataForType:tableTestDragType], diff --git a/Tests/Manual/TableTest/TableCibTest/AppController.j b/Tests/Manual/TableTest/TableCibTest/AppController.j index 1c7148276..0b0336dec 100644 --- a/Tests/Manual/TableTest/TableCibTest/AppController.j +++ b/Tests/Manual/TableTest/TableCibTest/AppController.j @@ -37,7 +37,7 @@ CPLogRegister(CPLogConsole); return 100000; } -- (id)tableView:(CPTableView)tableView objectValueForTableColumn:(CPTableColumn)tableColumn row:(int)row +- (id)tableView:(CPTableView)tableView objectValueForTableColumn:(CPTableColumn)tableColumn row:(CPInteger)row { if ([tableColumn identifier] === "icons") return iconImage; @@ -45,7 +45,7 @@ CPLogRegister(CPLogConsole); return String((row + 1) * [[tableColumn identifier] intValue]); } -- (BOOL)tableView:(CPTableView)tableView shouldReorderColumn:(int)columnIndex toColumn:(int)newColumnIndex +- (BOOL)tableView:(CPTableView)tableView shouldReorderColumn:(CPInteger)columnIndex toColumn:(CPInteger)newColumnIndex { if (columnIndex === 0 || newColumnIndex === 4) return NO; diff --git a/Tests/Manual/TableTest/TestTemplate_AppController.j b/Tests/Manual/TableTest/TestTemplate_AppController.j index 6f3b1440a..9be9584d7 100644 --- a/Tests/Manual/TableTest/TestTemplate_AppController.j +++ b/Tests/Manual/TableTest/TestTemplate_AppController.j @@ -67,7 +67,7 @@ return 10000; } -- (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRow +- (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow { return "Column " + [aColumn identifier] + " Row " + aRow; } diff --git a/Tests/Manual/TableTest/VariableRows/AppController.j b/Tests/Manual/TableTest/VariableRows/AppController.j index 4faf78a5b..e6a32bc50 100644 --- a/Tests/Manual/TableTest/VariableRows/AppController.j +++ b/Tests/Manual/TableTest/VariableRows/AppController.j @@ -83,18 +83,18 @@ var tableTestDragType = "tableTestDragType"; return 2000; } -- (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRow +- (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow { return "Column " + [aColumn identifier] + " Row " + aRow; } -- (int)tableView:(CPTableView)aTableView heightOfRow:(int)aRow +- (int)tableView:(CPTableView)aTableView heightOfRow:(CPInteger)aRow { return aRow % 2 ? 200 : 50; return aRow % 2 ? 1010 - (aRow * 10) : 10 + (aRow * 10); } -- (BOOL)tableView:(CPTableView)aTableView isGroupRow:(int)aRow +- (BOOL)tableView:(CPTableView)aTableView isGroupRow:(CPInteger)aRow { return !(aRow % 5); } @@ -131,7 +131,7 @@ var tableTestDragType = "tableTestDragType"; return CPDragOperationMove; } -- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id)info row:(int)row dropOperation:(CPTableViewDropOperation)operation +- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id)info row:(CPInteger)row dropOperation:(CPTableViewDropOperation)operation { return YES; } diff --git a/Tests/Manual/TableTest/ViewBased/AppController.j b/Tests/Manual/TableTest/ViewBased/AppController.j index c966a5dd1..7eef5b793 100644 --- a/Tests/Manual/TableTest/ViewBased/AppController.j +++ b/Tests/Manual/TableTest/ViewBased/AppController.j @@ -82,7 +82,7 @@ CPLogRegister(CPLogConsole) return content.length; } -- (void)tableView:(CPTableView)aTableView dataViewForTableColumn:(CPTableColumn)aTableColumn row:(int)aRow +- (void)tableView:(CPTableView)aTableView dataViewForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRow { var n = (aRow % 3), viewKind = "view_kind_" + n, diff --git a/Tests/Manual/TableTest/ViewBasedCib/AppController.j b/Tests/Manual/TableTest/ViewBasedCib/AppController.j index 4d422d33b..03c720fb3 100644 --- a/Tests/Manual/TableTest/ViewBasedCib/AppController.j +++ b/Tests/Manual/TableTest/ViewBasedCib/AppController.j @@ -112,7 +112,7 @@ CPLogRegister(CPLogConsole) } // DELEGATE METHODS FOR THE TABLE VIEW -- (void)tableView:(CPTableView)aTableView viewForTableColumn:(CPTableColumn)aTableColumn row:(int)aRow +- (void)tableView:(CPTableView)aTableView viewForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRow { var identifier = [aTableColumn identifier]; @@ -150,7 +150,7 @@ CPLogRegister(CPLogConsole) return CPDragOperationMove; } -- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id)info row:(int)row dropOperation:(CPTableViewDropOperation)operation +- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id)info row:(CPInteger)row dropOperation:(CPTableViewDropOperation)operation { var pboard = [info draggingPasteboard], sourceIndexes = [pboard dataForType:TABLE_DRAG_TYPE], @@ -168,7 +168,7 @@ CPLogRegister(CPLogConsole) return YES; } -- (int)tableView:(CPTableView)aTableView heightOfRow:(int)aRow +- (int)tableView:(CPTableView)aTableView heightOfRow:(CPInteger)aRow { var height; diff --git a/Tests/Manual/ThemeBrowser/AppController.j b/Tests/Manual/ThemeBrowser/AppController.j index 95660e794..f60e077d3 100644 --- a/Tests/Manual/ThemeBrowser/AppController.j +++ b/Tests/Manual/ThemeBrowser/AppController.j @@ -203,7 +203,7 @@ var BrowserColumnTheme = 0, return description; } -- (CPString)browser:(id)aBrowser titleOfColumn:(int)column +- (CPString)browser:(id)aBrowser titleOfColumn:(CPInteger)column { return ColumnTitles[column]; }