| 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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 else | 483 else |
| 484 { | 484 { |
| 485 result += " var type = HEAP32[result + " + std::to_string(offset)+
" >> 2];\n"; | 485 result += " var type = HEAP32[result + " + std::to_string(offset)+
" >> 2];\n"; |
| 486 result += " if (type in " + cls.name + "_mapping)\n"; | 486 result += " if (type in " + cls.name + "_mapping)\n"; |
| 487 result += " result = new (exports[" + cls.name + "_mapping[type]]
)(result);\n"; | 487 result += " result = new (exports[" + cls.name + "_mapping[type]]
)(result);\n"; |
| 488 result += " else\n"; | 488 result += " else\n"; |
| 489 result += " throw new Error('Unexpected " + cls.name + " type: '
+ type);\n"; | 489 result += " throw new Error('Unexpected " + cls.name + " type: '
+ type);\n"; |
| 490 } | 490 } |
| 491 | 491 |
| 492 result += " }\n"; | 492 result += " }\n"; |
| 493 result += " else\n"; |
| 494 result += " result = null;\n"; |
| 493 return result; | 495 return result; |
| 494 } | 496 } |
| 495 default: | 497 default: |
| 496 throw std::runtime_error("Unexpected return type for " + std::string(cal
l.name)); | 498 throw std::runtime_error("Unexpected return type for " + std::string(cal
l.name)); |
| 497 } | 499 } |
| 498 } | 500 } |
| 499 | 501 |
| 500 const std::string wrapCall(const FunctionInfo& call) | 502 const std::string wrapCall(const FunctionInfo& call) |
| 501 { | 503 { |
| 502 bool hasStringArgs = false; | 504 bool hasStringArgs = false; |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 | 795 |
| 794 std::vector<std::pair<int, std::string>> mapping; | 796 std::vector<std::pair<int, std::string>> mapping; |
| 795 for (const auto& item : list) | 797 for (const auto& item : list) |
| 796 mapping.emplace_back(item.first, item.second); | 798 mapping.emplace_back(item.first, item.second); |
| 797 | 799 |
| 798 bindings_internal::register_differentiator( | 800 bindings_internal::register_differentiator( |
| 799 bindings_internal::TypeInfo<ClassType>(), offset, mapping); | 801 bindings_internal::TypeInfo<ClassType>(), offset, mapping); |
| 800 return *this; | 802 return *this; |
| 801 } | 803 } |
| 802 }; | 804 }; |
| OLD | NEW |