devoncarew/gen_tools.dart — pull request #21 by financeCoding (2013-09-30 08:14:34+00:00)
Title: callback() uses factored out interfaceMember() methods _reduceParrameter & _parameterParser

In this patch I'm assuming we can't reach the situation where a single `callback` definition in the WebIDL file has multiple parameters. The specification does allow for an argument list. Reviewing some of the `.idl` files it looks like a few of them might use multiple parameters for callbacks.

audio.idl:

```javascript
callback GetInfoCallback = void(OutputDeviceInfo[] outputInfo,
InputDeviceInfo[] inputInfo);
```

file_system.idl:

```javascript
callback EntriesCallback = void (
[instanceOf=Entry] optional object entry,
[instanceOf=FileEntry] optional object[] fileEntries);
```
------

This patch also does not handle the situations where the `callback` defined in the idl has attributes which specify its type using `instanceOf`. `instanceOf` is not part of the standard so we will need to handle it.

IDL

```javascript
callback GetTabMediaCallback =
void ([instanceOf=LocalMediaStream] object stream);

interface Functions {
static void capture(CaptureOptions options,
GetTabMediaCallback callback);
}
```

Will generate

```dart
Future capture(CaptureOptions options) {
ChromeCompleter completer = new ChromeCompleter.oneArg();
_tabCapture.callMethod('capture', [options, completer.callback]);
return completer.future;
}
```

But should generate

```dart
Future capture(CaptureOptions options) {
ChromeCompleter completer = new ChromeCompleter.oneArg();
_tabCapture.callMethod('capture', [options, completer.callback]);
return completer.future;
}
```

------

Do we want to register the callback type for later lookup? Example like registering `AlarmCallback` in a parsed callback such as:

```dart
["AlarmCallback", "=", "void", [[EMPTY, [["Alarm", EMPTY], EMPTY, "alarm"]], EMPTY, ...], ";"]
```

------

regen apis to see changes