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

Delta Between Two Patch Sets: compiled/bindings/generator.cpp

Issue 29421701: Issue 5185 - [emscripten] More compact definition of class prototypes (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Left Patch Set: Created April 25, 2017, 2:13 p.m.
Right Patch Set: Removed bogus const modifiers Created April 26, 2017, 5:51 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « compiled/bindings/generator.h ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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
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
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 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld