All in parameters for commands use raw InspectorObjects and do ad-hoc shape checking. I think we can just generate assertValueHasExpectedType for all types and add accessors to the checked InspectorObject wrappers. Inside the dispatcher functions, all the argument shapes are asserted and casted in debug builds. -- Original code from InspectorDebuggerAgent::setBreakpoint -- RefPtr<InspectorObject> options = ...; String condition = emptyString(); bool autoContinue = false; RefPtr<InspectorArray> actions; if (options) { (*options)->getString(ASCIILiteral("condition"), &condition); (*options)->getBoolean(ASCIILiteral("autoContinue"), &autoContinue); actions = (*options)->getArray(ASCIILiteral("actions")); } -- Proposed refactor -- RefPtr<Protocol::Debugger::Options> options = ...; String condition = emptyString(); bool autoContinue = false; RefPtr<Protocol::Array<Protocol::Debugger::BreakpointAction>> actions; if (options) { options->getCondition(condition); options->getAutoContinue(autoContinue); options->getActions(actions); } This would require the getters to take the argument by reference if the parameter is optional.
Created attachment 241438 [details] WIP
<rdar://problem/18960076>
<rdar://problem/18960075>