| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 else | 452 else |
| 453 { | 453 { |
| 454 result += " var type = HEAP32[result + " + std::to_string(offset)+ "
>> 2];\n"; | 454 result += " var type = HEAP32[result + " + std::to_string(offset)+ "
>> 2];\n"; |
| 455 result += " if (type in " + cls.name + "_mapping)\n"; | 455 result += " if (type in " + cls.name + "_mapping)\n"; |
| 456 result += " result = new (exports[" + cls.name + "_mapping[type]])(
result);\n"; | 456 result += " result = new (exports[" + cls.name + "_mapping[type]])(
result);\n"; |
| 457 result += " else\n"; | 457 result += " else\n"; |
| 458 result += " throw new Error('Unexpected " + cls.name + " type: ' +
type);\n"; | 458 result += " throw new Error('Unexpected " + cls.name + " type: ' +
type);\n"; |
| 459 } | 459 } |
| 460 | 460 |
| 461 result += " }\n"; | 461 result += " }\n"; |
| 462 result += " else\n"; |
| 463 result += " result = null;\n"; |
| 462 return result; | 464 return result; |
| 463 } | 465 } |
| 464 else | 466 else |
| 465 throw std::runtime_error("Unexpected return type for " + std::string(call.
name)); | 467 throw std::runtime_error("Unexpected return type for " + std::string(call.
name)); |
| 466 } | 468 } |
| 467 | 469 |
| 468 const std::string wrapCall(const FunctionInfo& call) | 470 const std::string wrapCall(const FunctionInfo& call) |
| 469 { | 471 { |
| 470 char buffer[20]; | 472 char buffer[20]; |
| 471 bool hasStringArgs = false; | 473 bool hasStringArgs = false; |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 | 758 |
| 757 std::vector<std::pair<int, std::string>> mapping; | 759 std::vector<std::pair<int, std::string>> mapping; |
| 758 for (const auto& item : list) | 760 for (const auto& item : list) |
| 759 mapping.emplace_back(item.first, item.second); | 761 mapping.emplace_back(item.first, item.second); |
| 760 | 762 |
| 761 bindings_internal::register_differentiator( | 763 bindings_internal::register_differentiator( |
| 762 bindings_internal::TypeInfo<ClassType>(), offset, mapping); | 764 bindings_internal::TypeInfo<ClassType>(), offset, mapping); |
| 763 return *this; | 765 return *this; |
| 764 } | 766 } |
| 765 }; | 767 }; |
| OLD | NEW |