private void ProcessSubroutineBody(NodeBase subroutineBody, string functionMethodOrConstructor, string name) { Expect(subroutineBody, NodeType.SubroutineBody); Queue <NodeBase> children = GetChildren(subroutineBody); Expect(children.Dequeue(), NodeType.Symbol, "{"); int numberOfVariableDeclarations = ProcessVariableDeclarations(children); switch (functionMethodOrConstructor) { case "constructor": vmWriter.Constructor(className, name, classSize, numberOfVariableDeclarations); break; case "function": vmWriter.Function(className, name, numberOfVariableDeclarations); break; case "method": vmWriter.Method(className, name, numberOfVariableDeclarations); break; } ProcessStatements(children.Dequeue()); Expect(children.Dequeue(), NodeType.Symbol, "}"); }