| LEFT | RIGHT |
| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 if (classInfo->subclass_differentiator.offset != SIZE_MAX) | 247 if (classInfo->subclass_differentiator.offset != SIZE_MAX) |
| 248 throw std::runtime_error("More than one subclass differentiator defined fo
r class " + classInfo->name); | 248 throw std::runtime_error("More than one subclass differentiator defined fo
r class " + classInfo->name); |
| 249 | 249 |
| 250 DifferentiatorInfo differentiatorInfo; | 250 DifferentiatorInfo differentiatorInfo; |
| 251 differentiatorInfo.offset = offset; | 251 differentiatorInfo.offset = offset; |
| 252 differentiatorInfo.mapping = mapping; | 252 differentiatorInfo.mapping = mapping; |
| 253 classInfo->subclass_differentiator = differentiatorInfo; | 253 classInfo->subclass_differentiator = differentiatorInfo; |
| 254 } | 254 } |
| 255 | 255 |
| 256 const std::string generateCall(const FunctionInfo& call, | 256 std::string generateCall(const FunctionInfo& call, |
| 257 std::vector<std::string>& params) | 257 std::vector<std::string>& params) |
| 258 { | 258 { |
| 259 if (call.returnType == TypeCategory::DEPENDENT_STRING || | 259 if (call.returnType == TypeCategory::DEPENDENT_STRING || |
| 260 call.returnType == TypeCategory::OWNED_STRING) | 260 call.returnType == TypeCategory::OWNED_STRING) |
| 261 { | 261 { |
| 262 params.insert(params.begin(), "string"); | 262 params.insert(params.begin(), "string"); |
| 263 } | 263 } |
| 264 | 264 |
| 265 std::string call_str(call.name); | 265 std::string call_str(call.name); |
| 266 call_str += "("; | 266 call_str += "("; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 result += " }\n"; | 317 result += " }\n"; |
| 318 result += " else\n"; | 318 result += " else\n"; |
| 319 result += " result = null;\n"; | 319 result += " result = null;\n"; |
| 320 return result; | 320 return result; |
| 321 } | 321 } |
| 322 default: | 322 default: |
| 323 throw std::runtime_error("Unexpected return type for " + std::string(cal
l.name)); | 323 throw std::runtime_error("Unexpected return type for " + std::string(cal
l.name)); |
| 324 } | 324 } |
| 325 } | 325 } |
| 326 | 326 |
| 327 const std::string wrapCall(const FunctionInfo& call, bool isFunction) | 327 std::string wrapCall(const FunctionInfo& call, bool isFunction) |
| 328 { | 328 { |
| 329 bool hasStringArgs = false; | 329 bool hasStringArgs = false; |
| 330 std::vector<std::string> params; | 330 std::vector<std::string> params; |
| 331 std::string prefix; | 331 std::string prefix; |
| 332 | 332 |
| 333 if (isFunction) | 333 if (isFunction) |
| 334 prefix += "function"; | 334 prefix += "function"; |
| 335 prefix += "("; | 335 prefix += "("; |
| 336 for (int i = 0; i < call.args.size(); i++) | 336 for (int i = 0; i < call.args.size(); i++) |
| 337 { | 337 { |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 } | 500 } |
| 501 } | 501 } |
| 502 | 502 |
| 503 void printBindings() | 503 void printBindings() |
| 504 { | 504 { |
| 505 bindings_internal::printHelpers(); | 505 bindings_internal::printHelpers(); |
| 506 | 506 |
| 507 for (const auto& item : classes) | 507 for (const auto& item : classes) |
| 508 bindings_internal::printClass(item); | 508 bindings_internal::printClass(item); |
| 509 } | 509 } |
| LEFT | RIGHT |