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

Side by Side Diff: lib/typedObjects/arrayTypes.js

Issue 29324295: Noissue - Add missing semicolons (Closed)
Patch Set: Created Aug. 19, 2015, 10:19 a.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 | lib/typedObjects/references.js » ('j') | 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 29 matching lines...) Expand all
40 }; 40 };
41 } 41 }
42 42
43 function createSetter(elementSetter, elementShift) 43 function createSetter(elementSetter, elementShift)
44 { 44 {
45 return function(index, value) 45 return function(index, value)
46 { 46 {
47 if (index < 0 || index >= this.length) 47 if (index < 0 || index >= this.length)
48 throw new Error("Array index out of bounds"); 48 throw new Error("Array index out of bounds");
49 return elementSetter.call(this, this.arrayBufferIndex, this.arrayByteOffset + (index << elementShift), value); 49 return elementSetter.call(this, this.arrayBufferIndex, this.arrayByteOffset + (index << elementShift), value);
50 } 50 };
51 } 51 }
52 52
53 function createCombinedConstructor(customConstructor) 53 function createCombinedConstructor(customConstructor)
54 { 54 {
55 return function() 55 return function()
56 { 56 {
57 defaultArrayConstructor.apply(this); 57 defaultArrayConstructor.apply(this);
58 customConstructor.apply(this, arguments); 58 customConstructor.apply(this, arguments);
59 } 59 };
60 } 60 }
61 61
62 function createCombinedDestructor(customDestructor) 62 function createCombinedDestructor(customDestructor)
63 { 63 {
64 return function() 64 return function()
65 { 65 {
66 try 66 try
67 { 67 {
68 customDestructor.apply(this); 68 customDestructor.apply(this);
69 } 69 }
70 finally 70 finally
71 { 71 {
72 defaultArrayDestructor.apply(this); 72 defaultArrayDestructor.apply(this);
73 } 73 }
74 } 74 };
75 } 75 }
76 76
77 function createLengthWatcher(elementType, elementSetter) 77 function createLengthWatcher(elementType, elementSetter)
78 { 78 {
79 let {STATE_UNINITIALIZED} = require("typedObjects/objectTypes"); 79 let {STATE_UNINITIALIZED} = require("typedObjects/objectTypes");
80 return function lengthWatcher(newLength) 80 return function lengthWatcher(newLength)
81 { 81 {
82 newLength = newLength | 0; 82 newLength = newLength | 0;
83 if (newLength < 0) 83 if (newLength < 0)
84 newLength = 0; 84 newLength = 0;
(...skipping 29 matching lines...) Expand all
114 } 114 }
115 } 115 }
116 else 116 else
117 { 117 {
118 for (let i = newLength; i < length; i++) 118 for (let i = newLength; i < length; i++)
119 this.set(i, initialValue); 119 this.set(i, initialValue);
120 } 120 }
121 } 121 }
122 122
123 return newLength; 123 return newLength;
124 } 124 };
125 } 125 }
126 126
127 function createSizeWatcher(elementType, minElements, bufferSize, buffers, viewTy pes, views, firstFree) 127 function createSizeWatcher(elementType, minElements, bufferSize, buffers, viewTy pes, views, firstFree)
128 { 128 {
129 let referenceLength = elementType.referenceLength | 0; 129 let referenceLength = elementType.referenceLength | 0;
130 minElements = minElements | 0; 130 minElements = minElements | 0;
131 bufferSize = bufferSize | 0; 131 bufferSize = bufferSize | 0;
132 return function sizeWatcher(newSize) 132 return function sizeWatcher(newSize)
133 { 133 {
134 newSize = newSize | 0; 134 newSize = newSize | 0;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // Release old buffer 181 // Release old buffer
182 let reference = firstFree[size]; 182 let reference = firstFree[size];
183 if (typeof reference != "undefined") 183 if (typeof reference != "undefined")
184 dealloc(reference, origBufferIndex, origByteOffset); 184 dealloc(reference, origBufferIndex, origByteOffset);
185 else 185 else
186 removeBuffer(origBufferIndex, buffers, views); 186 removeBuffer(origBufferIndex, buffers, views);
187 } 187 }
188 } 188 }
189 189
190 return newSize; 190 return newSize;
191 } 191 };
192 } 192 }
193 193
194 function push() 194 function push()
195 { 195 {
196 let length = this.length | 0; 196 let length = this.length | 0;
197 let newCount = arguments.length | 0; 197 let newCount = arguments.length | 0;
198 this.length = length + newCount; 198 this.length = length + newCount;
199 for (let i = 0; i < newCount; i++) 199 for (let i = 0; i < newCount; i++)
200 this.set(length + i, arguments[i]); 200 this.set(length + i, arguments[i]);
201 return length + newCount; 201 return length + newCount;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 meta.watch = {}; 342 meta.watch = {};
343 343
344 meta.watch.length = createLengthWatcher(elementType, elementSetter); 344 meta.watch.length = createLengthWatcher(elementType, elementSetter);
345 meta.watch.size = createSizeWatcher(elementType, minElements, bufferSize, buff ers, viewTypes, views, firstFree); 345 meta.watch.size = createSizeWatcher(elementType, minElements, bufferSize, buff ers, viewTypes, views, firstFree);
346 346
347 let {ObjectBase} = require("typedObjects/objectTypes"); 347 let {ObjectBase} = require("typedObjects/objectTypes");
348 return ObjectBase.extend(typeDescriptor, meta); 348 return ObjectBase.extend(typeDescriptor, meta);
349 } 349 }
350 350
351 exports.createArrayType = createArrayType; 351 exports.createArrayType = createArrayType;
OLDNEW
« no previous file with comments | « no previous file | lib/typedObjects/references.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld