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

Side by Side Diff: lib/io.js

Issue 5825018483179520: Issue 2255 - Use "for (.. of ..)" loop for compatibility with ES6 generators (Closed)
Patch Set: Created April 1, 2015, 1:41 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 let lineBreak = this.lineBreak; 211 let lineBreak = this.lineBreak;
212 212
213 function writeChunk() 213 function writeChunk()
214 { 214 {
215 let array = encoder.encode(buf.join(lineBreak) + lineBreak); 215 let array = encoder.encode(buf.join(lineBreak) + lineBreak);
216 buf = []; 216 buf = [];
217 bufLen = 0; 217 bufLen = 0;
218 return f.write(array); 218 return f.write(array);
219 } 219 }
220 220
221 for (let line in data) 221 for (let line of data)
222 { 222 {
223 buf.push(line); 223 buf.push(line);
224 bufLen += line.length; 224 bufLen += line.length;
225 if (bufLen >= BUFFER_SIZE) 225 if (bufLen >= BUFFER_SIZE)
226 yield writeChunk(); 226 yield writeChunk();
227 } 227 }
228 228
229 if (bufLen) 229 if (bufLen)
230 yield writeChunk(); 230 yield writeChunk();
231 231
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 else 323 else
324 callback(e); 324 callback(e);
325 }); 325 });
326 } 326 }
327 catch(e) 327 catch(e)
328 { 328 {
329 callback(e); 329 callback(e);
330 } 330 }
331 } 331 }
332 } 332 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld