Left: | ||
Right: |
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-present 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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 case TypeCategory::INT64: | 220 case TypeCategory::INT64: |
221 return " var result = Runtime.makeBigInt(" + call_str + ", " + | 221 return " var result = Runtime.makeBigInt(" + call_str + ", " + |
222 "Runtime.getTempRet0(), " + | 222 "Runtime.getTempRet0(), " + |
223 "true);\n"; | 223 "true);\n"; |
224 case TypeCategory::DEPENDENT_STRING: | 224 case TypeCategory::DEPENDENT_STRING: |
225 { | 225 { |
226 std::string result; | 226 std::string result; |
227 result += " var string = createString();\n"; | 227 result += " var string = createString();\n"; |
228 result += " " + call_str + ";\n"; | 228 result += " " + call_str + ";\n"; |
229 result += " var result = readString(string);\n"; | 229 result += " var result = readString(string);\n"; |
230 // We don't call a destructor here because we know that dependent | |
231 // strings don't need to clean up. | |
230 return result; | 232 return result; |
sergei
2017/08/23 10:06:15
Strictly speaking, despite destructor of Dependent
Wladimir Palant
2017/08/23 10:26:41
Ok, I added a comment. In fact, we might need to c
sergei
2017/08/23 10:39:19
Yeah, I thought about similar debug needs too. If
| |
231 } | 233 } |
232 case TypeCategory::OWNED_STRING: | 234 case TypeCategory::OWNED_STRING: |
233 { | 235 { |
234 std::string result; | 236 std::string result; |
235 result += " var string = createOwnedString();\n"; | 237 result += " var string = createOwnedString();\n"; |
236 result += " " + call_str + ";\n"; | 238 result += " " + call_str + ";\n"; |
237 result += " var result = readString(string);\n"; | 239 result += " var result = readString(string);\n"; |
sergei
2017/08/23 10:06:15
Since anyway we have separate calls of Module._Ini
Wladimir Palant
2017/08/23 10:26:41
I tried that but it makes the code here less obvio
sergei
2017/08/23 10:39:19
Acknowledged.
| |
238 result += " Module._DestroyString(string);\n"; | 240 result += " Module._DestroyString(string);\n"; |
239 return result; | 241 return result; |
240 } | 242 } |
241 case TypeCategory::STRING_REF: | 243 case TypeCategory::STRING_REF: |
242 return " var result = readString(" + call_str + ");\n"; | 244 return " var result = readString(" + call_str + ");\n"; |
243 case TypeCategory::CLASS_PTR: | 245 case TypeCategory::CLASS_PTR: |
244 { | 246 { |
245 std::string result; | 247 std::string result; |
246 result += " var result = " + call_str + ";\n"; | 248 result += " var result = " + call_str + ";\n"; |
247 result += " if (result)\n"; | 249 result += " if (result)\n"; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
459 | 461 |
460 void printBindings() | 462 void printBindings() |
461 { | 463 { |
462 bindings_internal::printHelpers(); | 464 bindings_internal::printHelpers(); |
463 | 465 |
464 for (const auto& cls : classes) | 466 for (const auto& cls : classes) |
465 bindings_internal::printClass(cls); | 467 bindings_internal::printClass(cls); |
466 for (const auto& cls : classes) | 468 for (const auto& cls : classes) |
467 bindings_internal::printClassMapping(cls); | 469 bindings_internal::printClassMapping(cls); |
468 } | 470 } |
LEFT | RIGHT |