Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: compiled/bindings.ipp

Issue 29385742: Issue 4127 - [emscripten] Convert subscription classes to C++ - Part 2 (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Created March 16, 2017, 6:27 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #pragma once 1 #pragma once
2 2
3 #include <cstdint> 3 #include <cstdint>
4 #include <cstdio> 4 #include <cstdio>
5 #include <cstdlib> 5 #include <cstdlib>
6 #include <exception> 6 #include <exception>
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <type_traits> 9 #include <type_traits>
10 #include <utility> 10 #include <utility>
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 else 434 else
435 { 435 {
436 result += " var type = HEAP32[result + " + std::to_string(offset)+ " >> 2];\n"; 436 result += " var type = HEAP32[result + " + std::to_string(offset)+ " >> 2];\n";
437 result += " if (type in " + cls.name + "_mapping)\n"; 437 result += " if (type in " + cls.name + "_mapping)\n";
438 result += " result = new (exports[" + cls.name + "_mapping[type]])( result);\n"; 438 result += " result = new (exports[" + cls.name + "_mapping[type]])( result);\n";
439 result += " else\n"; 439 result += " else\n";
440 result += " throw new Error('Unexpected " + cls.name + " type: ' + type);\n"; 440 result += " throw new Error('Unexpected " + cls.name + " type: ' + type);\n";
441 } 441 }
442 442
443 result += " }\n"; 443 result += " }\n";
444 result += " else\n";
445 result += " result = null;\n";
Wladimir Palant 2017/03/16 18:31:23 This isn't strictly necessary but expecting 0 as r
444 return result; 446 return result;
445 } 447 }
446 else 448 else
447 throw std::runtime_error("Unexpected return type for " + std::string(call. name)); 449 throw std::runtime_error("Unexpected return type for " + std::string(call. name));
448 } 450 }
449 451
450 const std::string wrapCall(const FunctionInfo& call) 452 const std::string wrapCall(const FunctionInfo& call)
451 { 453 {
452 char buffer[20]; 454 char buffer[20];
453 bool hasStringArgs = false; 455 bool hasStringArgs = false;
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 740
739 std::vector<std::pair<int, std::string>> mapping; 741 std::vector<std::pair<int, std::string>> mapping;
740 for (const auto& item : list) 742 for (const auto& item : list)
741 mapping.emplace_back(item.first, item.second); 743 mapping.emplace_back(item.first, item.second);
742 744
743 bindings_internal::register_differentiator( 745 bindings_internal::register_differentiator(
744 bindings_internal::TypeInfo<ClassType>(), offset, mapping); 746 bindings_internal::TypeInfo<ClassType>(), offset, mapping);
745 return *this; 747 return *this;
746 } 748 }
747 }; 749 };
OLDNEW
« no previous file with comments | « compiled/bindings.cpp ('k') | compiled/filter/Filter.h » ('j') | compiled/filter/Filter.h » ('J')

Powered by Google App Engine
This is Rietveld