OLD | NEW |
(Empty) | |
| 1 function get_interface_names(global_object, interface_names) { |
| 2 var result = []; |
| 3 function collect_property_info(object, property_name, output) { |
| 4 var descriptor = Object.getOwnPropertyDescriptor(object, property_name); |
| 5 if ('value' in descriptor) { |
| 6 if (typeof descriptor.value === 'function') { |
| 7 output.push(' method ' + property_name); |
| 8 } else { |
| 9 output.push(' attribute ' + property_name); |
| 10 } |
| 11 } else { |
| 12 if (descriptor.get) { |
| 13 output.push(' getter ' + property_name); |
| 14 } |
| 15 if (descriptor.set) { |
| 16 output.push(' setter ' + property_name); |
| 17 } |
| 18 } |
| 19 } |
| 20 interface_names.sort(); |
| 21 interface_names.forEach(function(interface_name) { |
| 22 if (this[interface_name] === undefined) { |
| 23 return; |
| 24 } |
| 25 result.push('interface ' + interface_name); |
| 26 var property_names = |
| 27 Object.getOwnPropertyNames(this[interface_name].prototype); |
| 28 var property_strings = []; |
| 29 property_names.forEach(function(property_name) { |
| 30 collect_property_info(this[interface_name].prototype, |
| 31 property_name, |
| 32 property_strings); |
| 33 }); |
| 34 result.push.apply(result, property_strings.sort()); |
| 35 }); |
| 36 return result.join("\n");; |
| 37 } |
OLD | NEW |