Merge pull request #2213 from mrcarlberg/error_cannot_find_protocol_declaration

Fixed: When the compiler can't find a protocol in a class declaration
This commit is contained in:
Antoine Mercadal committed 2014-09-30 16:56:36 -07:00
commit 73a2823d0b
1 file changed
+11 -3
+11 -3
View File
@@ -1778,7 +1778,8 @@ ClassDeclarationStatement: function(node, st, c) {
var getterSetterBuffer = new StringBuffer();
// Add the class declaration to compile accessors correctly
getterSetterBuffer.concat(compiler.source.substring(node.start, node.endOfIvars));
// Remove all protocols from class declaration
getterSetterBuffer.concat(compiler.source.substring(node.start, node.endOfIvars).replace(/<.*>/g, ""));
getterSetterBuffer.concat("\n");
for (var i = 0; i < node.ivardeclarations.length; ++i)
@@ -1893,8 +1894,15 @@ ClassDeclarationStatement: function(node, st, c) {
// 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));
for (var i = 0, size = protocols.length; i < size; i++) {
var protocol = protocols[i],
protocolDef = compiler.getProtocolDef(protocol.name);
if (!protocolDef)
throw compiler.error_message("Cannot find protocol declaration for '" + protocol.name + "'", protocol);
protocolDefs.push(protocolDef);
}
var unimplementedMethods = classDef.listOfNotImplementedMethodsForProtocols(protocolDefs);