├── main.js ├── package.json ├── proto ├── operations_pb.js ├── program_pb.js ├── sync_pb.js └── typesystem_pb.js ├── readme.md └── src ├── builtinGen.js ├── compile.js ├── funcDeclSort.js ├── genProto.js ├── hoist.js ├── identifierAnalysis.js ├── preprocessV8.js └── useAnalysis.js /main.js: -------------------------------------------------------------------------------- 1 | const hoist=require('./src/hoist.js'); 2 | const useAnalysis=require('./src/useAnalysis.js'); 3 | const funcDeclSort=require('./src/funcDeclSort.js'); 4 | const identifierAnalysis=require('./src/identifierAnalysis.js'); 5 | const compile=require('./src/compile.js'); 6 | const fs=require('fs'); 7 | const acorn=require('acorn'); 8 | const jspb=require('google-protobuf'); 9 | 10 | if (process.argv.length!=4) { 11 | console.log('Usage: node main.js input.js output.fuzzil.protofbuf'); 12 | process.exit(139); 13 | } 14 | const jsPath=process.argv[2]; 15 | const outPath=process.argv[3]; 16 | const js=fs.readFileSync(jsPath); 17 | let ast; 18 | try { 19 | ast=acorn.parse(js, {ecmaVersion: 2022}); 20 | } catch { 21 | console.log('Acorn parse error'); 22 | process.exit(139); 23 | } 24 | 25 | hoist.hoist(ast); 26 | useAnalysis.useAnalysis(ast); 27 | funcDeclSort.funcDeclSort(ast); 28 | identifierAnalysis.identifierAnalysis(ast); 29 | const fuzzilProgram = compile.compile(ast); 30 | 31 | const bwriter = new jspb.BinaryWriter(); 32 | proto.fuzzilli.protobuf.Program.serializeBinaryToWriter(fuzzilProgram, bwriter); 33 | const buff=bwriter.getResultBuffer(); 34 | fs.writeFileSync(outPath, Buffer.from(buff)); 35 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prototest", 3 | "version": "1.0.0", 4 | "dependencies": { 5 | "acorn": "^8.4.1", 6 | "google-protobuf": "latest" 7 | }, 8 | "main": "index.js", 9 | "scripts": { 10 | "test": "echo \"Error: no test specified\" && exit 1" 11 | }, 12 | "extends": "google", 13 | "author": "", 14 | "license": "ISC", 15 | "devDependencies": { 16 | "eslint": "^7.29.0", 17 | "eslint-config-google": "^0.14.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /proto/sync_pb.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview 3 | * @enhanceable 4 | * @suppress {messageConventions} JS Compiler reports an error if a variable or 5 | * field starts with 'MSG_' and isn't a translatable message. 6 | * @public 7 | */ 8 | // GENERATED CODE -- DO NOT EDIT! 9 | 10 | var jspb = require('google-protobuf'); 11 | var goog = jspb; 12 | var global = Function('return this')(); 13 | 14 | goog.exportSymbol('proto.fuzzilli.protobuf.FuzzerState', null, global); 15 | goog.exportSymbol('proto.fuzzilli.protobuf.Identification', null, global); 16 | goog.exportSymbol('proto.fuzzilli.protobuf.LogMessage', null, global); 17 | goog.exportSymbol('proto.fuzzilli.protobuf.Statistics', null, global); 18 | 19 | /** 20 | * Generated by JsPbCodeGenerator. 21 | * @param {Array=} opt_data Optional initial data array, typically from a 22 | * server response, or constructed directly in Javascript. The array is used 23 | * in place and becomes part of the constructed object. It is not cloned. 24 | * If no data is provided, the constructed object will be empty, but still 25 | * valid. 26 | * @extends {jspb.Message} 27 | * @constructor 28 | */ 29 | proto.fuzzilli.protobuf.Identification = function(opt_data) { 30 | jspb.Message.initialize(this, opt_data, 0, -1, null, null); 31 | }; 32 | goog.inherits(proto.fuzzilli.protobuf.Identification, jspb.Message); 33 | if (goog.DEBUG && !COMPILED) { 34 | proto.fuzzilli.protobuf.Identification.displayName = 'proto.fuzzilli.protobuf.Identification'; 35 | } 36 | 37 | 38 | if (jspb.Message.GENERATE_TO_OBJECT) { 39 | /** 40 | * Creates an object representation of this proto suitable for use in Soy templates. 41 | * Field names that are reserved in JavaScript and will be renamed to pb_name. 42 | * To access a reserved field use, foo.pb_, eg, foo.pb_default. 43 | * For the list of reserved names please see: 44 | * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. 45 | * @param {boolean=} opt_includeInstance Whether to include the JSPB instance 46 | * for transitional soy proto support: http://goto/soy-param-migration 47 | * @return {!Object} 48 | */ 49 | proto.fuzzilli.protobuf.Identification.prototype.toObject = function(opt_includeInstance) { 50 | return proto.fuzzilli.protobuf.Identification.toObject(opt_includeInstance, this); 51 | }; 52 | 53 | 54 | /** 55 | * Static version of the {@see toObject} method. 56 | * @param {boolean|undefined} includeInstance Whether to include the JSPB 57 | * instance for transitional soy proto support: 58 | * http://goto/soy-param-migration 59 | * @param {!proto.fuzzilli.protobuf.Identification} msg The msg instance to transform. 60 | * @return {!Object} 61 | * @suppress {unusedLocalVariables} f is only used for nested messages 62 | */ 63 | proto.fuzzilli.protobuf.Identification.toObject = function(includeInstance, msg) { 64 | var f, obj = { 65 | uuid: msg.getUuid_asB64() 66 | }; 67 | 68 | if (includeInstance) { 69 | obj.$jspbMessageInstance = msg; 70 | } 71 | return obj; 72 | }; 73 | } 74 | 75 | 76 | /** 77 | * Deserializes binary data (in protobuf wire format). 78 | * @param {jspb.ByteSource} bytes The bytes to deserialize. 79 | * @return {!proto.fuzzilli.protobuf.Identification} 80 | */ 81 | proto.fuzzilli.protobuf.Identification.deserializeBinary = function(bytes) { 82 | var reader = new jspb.BinaryReader(bytes); 83 | var msg = new proto.fuzzilli.protobuf.Identification; 84 | return proto.fuzzilli.protobuf.Identification.deserializeBinaryFromReader(msg, reader); 85 | }; 86 | 87 | 88 | /** 89 | * Deserializes binary data (in protobuf wire format) from the 90 | * given reader into the given message object. 91 | * @param {!proto.fuzzilli.protobuf.Identification} msg The message object to deserialize into. 92 | * @param {!jspb.BinaryReader} reader The BinaryReader to use. 93 | * @return {!proto.fuzzilli.protobuf.Identification} 94 | */ 95 | proto.fuzzilli.protobuf.Identification.deserializeBinaryFromReader = function(msg, reader) { 96 | while (reader.nextField()) { 97 | if (reader.isEndGroup()) { 98 | break; 99 | } 100 | var field = reader.getFieldNumber(); 101 | switch (field) { 102 | case 1: 103 | var value = /** @type {!Uint8Array} */ (reader.readBytes()); 104 | msg.setUuid(value); 105 | break; 106 | default: 107 | reader.skipField(); 108 | break; 109 | } 110 | } 111 | return msg; 112 | }; 113 | 114 | 115 | /** 116 | * Serializes the message to binary data (in protobuf wire format). 117 | * @return {!Uint8Array} 118 | */ 119 | proto.fuzzilli.protobuf.Identification.prototype.serializeBinary = function() { 120 | var writer = new jspb.BinaryWriter(); 121 | proto.fuzzilli.protobuf.Identification.serializeBinaryToWriter(this, writer); 122 | return writer.getResultBuffer(); 123 | }; 124 | 125 | 126 | /** 127 | * Serializes the given message to binary data (in protobuf wire 128 | * format), writing to the given BinaryWriter. 129 | * @param {!proto.fuzzilli.protobuf.Identification} message 130 | * @param {!jspb.BinaryWriter} writer 131 | * @suppress {unusedLocalVariables} f is only used for nested messages 132 | */ 133 | proto.fuzzilli.protobuf.Identification.serializeBinaryToWriter = function(message, writer) { 134 | var f = undefined; 135 | f = message.getUuid_asU8(); 136 | if (f.length > 0) { 137 | writer.writeBytes( 138 | 1, 139 | f 140 | ); 141 | } 142 | }; 143 | 144 | 145 | /** 146 | * optional bytes uuid = 1; 147 | * @return {!(string|Uint8Array)} 148 | */ 149 | proto.fuzzilli.protobuf.Identification.prototype.getUuid = function() { 150 | return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); 151 | }; 152 | 153 | 154 | /** 155 | * optional bytes uuid = 1; 156 | * This is a type-conversion wrapper around `getUuid()` 157 | * @return {string} 158 | */ 159 | proto.fuzzilli.protobuf.Identification.prototype.getUuid_asB64 = function() { 160 | return /** @type {string} */ (jspb.Message.bytesAsB64( 161 | this.getUuid())); 162 | }; 163 | 164 | 165 | /** 166 | * optional bytes uuid = 1; 167 | * Note that Uint8Array is not supported on all browsers. 168 | * @see http://caniuse.com/Uint8Array 169 | * This is a type-conversion wrapper around `getUuid()` 170 | * @return {!Uint8Array} 171 | */ 172 | proto.fuzzilli.protobuf.Identification.prototype.getUuid_asU8 = function() { 173 | return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( 174 | this.getUuid())); 175 | }; 176 | 177 | 178 | /** @param {!(string|Uint8Array)} value */ 179 | proto.fuzzilli.protobuf.Identification.prototype.setUuid = function(value) { 180 | jspb.Message.setProto3BytesField(this, 1, value); 181 | }; 182 | 183 | 184 | 185 | /** 186 | * Generated by JsPbCodeGenerator. 187 | * @param {Array=} opt_data Optional initial data array, typically from a 188 | * server response, or constructed directly in Javascript. The array is used 189 | * in place and becomes part of the constructed object. It is not cloned. 190 | * If no data is provided, the constructed object will be empty, but still 191 | * valid. 192 | * @extends {jspb.Message} 193 | * @constructor 194 | */ 195 | proto.fuzzilli.protobuf.LogMessage = function(opt_data) { 196 | jspb.Message.initialize(this, opt_data, 0, -1, null, null); 197 | }; 198 | goog.inherits(proto.fuzzilli.protobuf.LogMessage, jspb.Message); 199 | if (goog.DEBUG && !COMPILED) { 200 | proto.fuzzilli.protobuf.LogMessage.displayName = 'proto.fuzzilli.protobuf.LogMessage'; 201 | } 202 | 203 | 204 | if (jspb.Message.GENERATE_TO_OBJECT) { 205 | /** 206 | * Creates an object representation of this proto suitable for use in Soy templates. 207 | * Field names that are reserved in JavaScript and will be renamed to pb_name. 208 | * To access a reserved field use, foo.pb_, eg, foo.pb_default. 209 | * For the list of reserved names please see: 210 | * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. 211 | * @param {boolean=} opt_includeInstance Whether to include the JSPB instance 212 | * for transitional soy proto support: http://goto/soy-param-migration 213 | * @return {!Object} 214 | */ 215 | proto.fuzzilli.protobuf.LogMessage.prototype.toObject = function(opt_includeInstance) { 216 | return proto.fuzzilli.protobuf.LogMessage.toObject(opt_includeInstance, this); 217 | }; 218 | 219 | 220 | /** 221 | * Static version of the {@see toObject} method. 222 | * @param {boolean|undefined} includeInstance Whether to include the JSPB 223 | * instance for transitional soy proto support: 224 | * http://goto/soy-param-migration 225 | * @param {!proto.fuzzilli.protobuf.LogMessage} msg The msg instance to transform. 226 | * @return {!Object} 227 | * @suppress {unusedLocalVariables} f is only used for nested messages 228 | */ 229 | proto.fuzzilli.protobuf.LogMessage.toObject = function(includeInstance, msg) { 230 | var f, obj = { 231 | origin: jspb.Message.getFieldWithDefault(msg, 1, ""), 232 | level: jspb.Message.getFieldWithDefault(msg, 2, 0), 233 | label: jspb.Message.getFieldWithDefault(msg, 3, ""), 234 | content: jspb.Message.getFieldWithDefault(msg, 4, "") 235 | }; 236 | 237 | if (includeInstance) { 238 | obj.$jspbMessageInstance = msg; 239 | } 240 | return obj; 241 | }; 242 | } 243 | 244 | 245 | /** 246 | * Deserializes binary data (in protobuf wire format). 247 | * @param {jspb.ByteSource} bytes The bytes to deserialize. 248 | * @return {!proto.fuzzilli.protobuf.LogMessage} 249 | */ 250 | proto.fuzzilli.protobuf.LogMessage.deserializeBinary = function(bytes) { 251 | var reader = new jspb.BinaryReader(bytes); 252 | var msg = new proto.fuzzilli.protobuf.LogMessage; 253 | return proto.fuzzilli.protobuf.LogMessage.deserializeBinaryFromReader(msg, reader); 254 | }; 255 | 256 | 257 | /** 258 | * Deserializes binary data (in protobuf wire format) from the 259 | * given reader into the given message object. 260 | * @param {!proto.fuzzilli.protobuf.LogMessage} msg The message object to deserialize into. 261 | * @param {!jspb.BinaryReader} reader The BinaryReader to use. 262 | * @return {!proto.fuzzilli.protobuf.LogMessage} 263 | */ 264 | proto.fuzzilli.protobuf.LogMessage.deserializeBinaryFromReader = function(msg, reader) { 265 | while (reader.nextField()) { 266 | if (reader.isEndGroup()) { 267 | break; 268 | } 269 | var field = reader.getFieldNumber(); 270 | switch (field) { 271 | case 1: 272 | var value = /** @type {string} */ (reader.readString()); 273 | msg.setOrigin(value); 274 | break; 275 | case 2: 276 | var value = /** @type {number} */ (reader.readUint32()); 277 | msg.setLevel(value); 278 | break; 279 | case 3: 280 | var value = /** @type {string} */ (reader.readString()); 281 | msg.setLabel(value); 282 | break; 283 | case 4: 284 | var value = /** @type {string} */ (reader.readString()); 285 | msg.setContent(value); 286 | break; 287 | default: 288 | reader.skipField(); 289 | break; 290 | } 291 | } 292 | return msg; 293 | }; 294 | 295 | 296 | /** 297 | * Serializes the message to binary data (in protobuf wire format). 298 | * @return {!Uint8Array} 299 | */ 300 | proto.fuzzilli.protobuf.LogMessage.prototype.serializeBinary = function() { 301 | var writer = new jspb.BinaryWriter(); 302 | proto.fuzzilli.protobuf.LogMessage.serializeBinaryToWriter(this, writer); 303 | return writer.getResultBuffer(); 304 | }; 305 | 306 | 307 | /** 308 | * Serializes the given message to binary data (in protobuf wire 309 | * format), writing to the given BinaryWriter. 310 | * @param {!proto.fuzzilli.protobuf.LogMessage} message 311 | * @param {!jspb.BinaryWriter} writer 312 | * @suppress {unusedLocalVariables} f is only used for nested messages 313 | */ 314 | proto.fuzzilli.protobuf.LogMessage.serializeBinaryToWriter = function(message, writer) { 315 | var f = undefined; 316 | f = message.getOrigin(); 317 | if (f.length > 0) { 318 | writer.writeString( 319 | 1, 320 | f 321 | ); 322 | } 323 | f = message.getLevel(); 324 | if (f !== 0) { 325 | writer.writeUint32( 326 | 2, 327 | f 328 | ); 329 | } 330 | f = message.getLabel(); 331 | if (f.length > 0) { 332 | writer.writeString( 333 | 3, 334 | f 335 | ); 336 | } 337 | f = message.getContent(); 338 | if (f.length > 0) { 339 | writer.writeString( 340 | 4, 341 | f 342 | ); 343 | } 344 | }; 345 | 346 | 347 | /** 348 | * optional string origin = 1; 349 | * @return {string} 350 | */ 351 | proto.fuzzilli.protobuf.LogMessage.prototype.getOrigin = function() { 352 | return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); 353 | }; 354 | 355 | 356 | /** @param {string} value */ 357 | proto.fuzzilli.protobuf.LogMessage.prototype.setOrigin = function(value) { 358 | jspb.Message.setProto3StringField(this, 1, value); 359 | }; 360 | 361 | 362 | /** 363 | * optional uint32 level = 2; 364 | * @return {number} 365 | */ 366 | proto.fuzzilli.protobuf.LogMessage.prototype.getLevel = function() { 367 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); 368 | }; 369 | 370 | 371 | /** @param {number} value */ 372 | proto.fuzzilli.protobuf.LogMessage.prototype.setLevel = function(value) { 373 | jspb.Message.setProto3IntField(this, 2, value); 374 | }; 375 | 376 | 377 | /** 378 | * optional string label = 3; 379 | * @return {string} 380 | */ 381 | proto.fuzzilli.protobuf.LogMessage.prototype.getLabel = function() { 382 | return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); 383 | }; 384 | 385 | 386 | /** @param {string} value */ 387 | proto.fuzzilli.protobuf.LogMessage.prototype.setLabel = function(value) { 388 | jspb.Message.setProto3StringField(this, 3, value); 389 | }; 390 | 391 | 392 | /** 393 | * optional string content = 4; 394 | * @return {string} 395 | */ 396 | proto.fuzzilli.protobuf.LogMessage.prototype.getContent = function() { 397 | return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); 398 | }; 399 | 400 | 401 | /** @param {string} value */ 402 | proto.fuzzilli.protobuf.LogMessage.prototype.setContent = function(value) { 403 | jspb.Message.setProto3StringField(this, 4, value); 404 | }; 405 | 406 | 407 | 408 | /** 409 | * Generated by JsPbCodeGenerator. 410 | * @param {Array=} opt_data Optional initial data array, typically from a 411 | * server response, or constructed directly in Javascript. The array is used 412 | * in place and becomes part of the constructed object. It is not cloned. 413 | * If no data is provided, the constructed object will be empty, but still 414 | * valid. 415 | * @extends {jspb.Message} 416 | * @constructor 417 | */ 418 | proto.fuzzilli.protobuf.FuzzerState = function(opt_data) { 419 | jspb.Message.initialize(this, opt_data, 0, -1, null, null); 420 | }; 421 | goog.inherits(proto.fuzzilli.protobuf.FuzzerState, jspb.Message); 422 | if (goog.DEBUG && !COMPILED) { 423 | proto.fuzzilli.protobuf.FuzzerState.displayName = 'proto.fuzzilli.protobuf.FuzzerState'; 424 | } 425 | 426 | 427 | if (jspb.Message.GENERATE_TO_OBJECT) { 428 | /** 429 | * Creates an object representation of this proto suitable for use in Soy templates. 430 | * Field names that are reserved in JavaScript and will be renamed to pb_name. 431 | * To access a reserved field use, foo.pb_, eg, foo.pb_default. 432 | * For the list of reserved names please see: 433 | * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. 434 | * @param {boolean=} opt_includeInstance Whether to include the JSPB instance 435 | * for transitional soy proto support: http://goto/soy-param-migration 436 | * @return {!Object} 437 | */ 438 | proto.fuzzilli.protobuf.FuzzerState.prototype.toObject = function(opt_includeInstance) { 439 | return proto.fuzzilli.protobuf.FuzzerState.toObject(opt_includeInstance, this); 440 | }; 441 | 442 | 443 | /** 444 | * Static version of the {@see toObject} method. 445 | * @param {boolean|undefined} includeInstance Whether to include the JSPB 446 | * instance for transitional soy proto support: 447 | * http://goto/soy-param-migration 448 | * @param {!proto.fuzzilli.protobuf.FuzzerState} msg The msg instance to transform. 449 | * @return {!Object} 450 | * @suppress {unusedLocalVariables} f is only used for nested messages 451 | */ 452 | proto.fuzzilli.protobuf.FuzzerState.toObject = function(includeInstance, msg) { 453 | var f, obj = { 454 | corpus: msg.getCorpus_asB64(), 455 | evaluatorstate: msg.getEvaluatorstate_asB64() 456 | }; 457 | 458 | if (includeInstance) { 459 | obj.$jspbMessageInstance = msg; 460 | } 461 | return obj; 462 | }; 463 | } 464 | 465 | 466 | /** 467 | * Deserializes binary data (in protobuf wire format). 468 | * @param {jspb.ByteSource} bytes The bytes to deserialize. 469 | * @return {!proto.fuzzilli.protobuf.FuzzerState} 470 | */ 471 | proto.fuzzilli.protobuf.FuzzerState.deserializeBinary = function(bytes) { 472 | var reader = new jspb.BinaryReader(bytes); 473 | var msg = new proto.fuzzilli.protobuf.FuzzerState; 474 | return proto.fuzzilli.protobuf.FuzzerState.deserializeBinaryFromReader(msg, reader); 475 | }; 476 | 477 | 478 | /** 479 | * Deserializes binary data (in protobuf wire format) from the 480 | * given reader into the given message object. 481 | * @param {!proto.fuzzilli.protobuf.FuzzerState} msg The message object to deserialize into. 482 | * @param {!jspb.BinaryReader} reader The BinaryReader to use. 483 | * @return {!proto.fuzzilli.protobuf.FuzzerState} 484 | */ 485 | proto.fuzzilli.protobuf.FuzzerState.deserializeBinaryFromReader = function(msg, reader) { 486 | while (reader.nextField()) { 487 | if (reader.isEndGroup()) { 488 | break; 489 | } 490 | var field = reader.getFieldNumber(); 491 | switch (field) { 492 | case 1: 493 | var value = /** @type {!Uint8Array} */ (reader.readBytes()); 494 | msg.setCorpus(value); 495 | break; 496 | case 2: 497 | var value = /** @type {!Uint8Array} */ (reader.readBytes()); 498 | msg.setEvaluatorstate(value); 499 | break; 500 | default: 501 | reader.skipField(); 502 | break; 503 | } 504 | } 505 | return msg; 506 | }; 507 | 508 | 509 | /** 510 | * Serializes the message to binary data (in protobuf wire format). 511 | * @return {!Uint8Array} 512 | */ 513 | proto.fuzzilli.protobuf.FuzzerState.prototype.serializeBinary = function() { 514 | var writer = new jspb.BinaryWriter(); 515 | proto.fuzzilli.protobuf.FuzzerState.serializeBinaryToWriter(this, writer); 516 | return writer.getResultBuffer(); 517 | }; 518 | 519 | 520 | /** 521 | * Serializes the given message to binary data (in protobuf wire 522 | * format), writing to the given BinaryWriter. 523 | * @param {!proto.fuzzilli.protobuf.FuzzerState} message 524 | * @param {!jspb.BinaryWriter} writer 525 | * @suppress {unusedLocalVariables} f is only used for nested messages 526 | */ 527 | proto.fuzzilli.protobuf.FuzzerState.serializeBinaryToWriter = function(message, writer) { 528 | var f = undefined; 529 | f = message.getCorpus_asU8(); 530 | if (f.length > 0) { 531 | writer.writeBytes( 532 | 1, 533 | f 534 | ); 535 | } 536 | f = message.getEvaluatorstate_asU8(); 537 | if (f.length > 0) { 538 | writer.writeBytes( 539 | 2, 540 | f 541 | ); 542 | } 543 | }; 544 | 545 | 546 | /** 547 | * optional bytes corpus = 1; 548 | * @return {!(string|Uint8Array)} 549 | */ 550 | proto.fuzzilli.protobuf.FuzzerState.prototype.getCorpus = function() { 551 | return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); 552 | }; 553 | 554 | 555 | /** 556 | * optional bytes corpus = 1; 557 | * This is a type-conversion wrapper around `getCorpus()` 558 | * @return {string} 559 | */ 560 | proto.fuzzilli.protobuf.FuzzerState.prototype.getCorpus_asB64 = function() { 561 | return /** @type {string} */ (jspb.Message.bytesAsB64( 562 | this.getCorpus())); 563 | }; 564 | 565 | 566 | /** 567 | * optional bytes corpus = 1; 568 | * Note that Uint8Array is not supported on all browsers. 569 | * @see http://caniuse.com/Uint8Array 570 | * This is a type-conversion wrapper around `getCorpus()` 571 | * @return {!Uint8Array} 572 | */ 573 | proto.fuzzilli.protobuf.FuzzerState.prototype.getCorpus_asU8 = function() { 574 | return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( 575 | this.getCorpus())); 576 | }; 577 | 578 | 579 | /** @param {!(string|Uint8Array)} value */ 580 | proto.fuzzilli.protobuf.FuzzerState.prototype.setCorpus = function(value) { 581 | jspb.Message.setProto3BytesField(this, 1, value); 582 | }; 583 | 584 | 585 | /** 586 | * optional bytes evaluatorState = 2; 587 | * @return {!(string|Uint8Array)} 588 | */ 589 | proto.fuzzilli.protobuf.FuzzerState.prototype.getEvaluatorstate = function() { 590 | return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); 591 | }; 592 | 593 | 594 | /** 595 | * optional bytes evaluatorState = 2; 596 | * This is a type-conversion wrapper around `getEvaluatorstate()` 597 | * @return {string} 598 | */ 599 | proto.fuzzilli.protobuf.FuzzerState.prototype.getEvaluatorstate_asB64 = function() { 600 | return /** @type {string} */ (jspb.Message.bytesAsB64( 601 | this.getEvaluatorstate())); 602 | }; 603 | 604 | 605 | /** 606 | * optional bytes evaluatorState = 2; 607 | * Note that Uint8Array is not supported on all browsers. 608 | * @see http://caniuse.com/Uint8Array 609 | * This is a type-conversion wrapper around `getEvaluatorstate()` 610 | * @return {!Uint8Array} 611 | */ 612 | proto.fuzzilli.protobuf.FuzzerState.prototype.getEvaluatorstate_asU8 = function() { 613 | return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( 614 | this.getEvaluatorstate())); 615 | }; 616 | 617 | 618 | /** @param {!(string|Uint8Array)} value */ 619 | proto.fuzzilli.protobuf.FuzzerState.prototype.setEvaluatorstate = function(value) { 620 | jspb.Message.setProto3BytesField(this, 2, value); 621 | }; 622 | 623 | 624 | 625 | /** 626 | * Generated by JsPbCodeGenerator. 627 | * @param {Array=} opt_data Optional initial data array, typically from a 628 | * server response, or constructed directly in Javascript. The array is used 629 | * in place and becomes part of the constructed object. It is not cloned. 630 | * If no data is provided, the constructed object will be empty, but still 631 | * valid. 632 | * @extends {jspb.Message} 633 | * @constructor 634 | */ 635 | proto.fuzzilli.protobuf.Statistics = function(opt_data) { 636 | jspb.Message.initialize(this, opt_data, 0, -1, null, null); 637 | }; 638 | goog.inherits(proto.fuzzilli.protobuf.Statistics, jspb.Message); 639 | if (goog.DEBUG && !COMPILED) { 640 | proto.fuzzilli.protobuf.Statistics.displayName = 'proto.fuzzilli.protobuf.Statistics'; 641 | } 642 | 643 | 644 | if (jspb.Message.GENERATE_TO_OBJECT) { 645 | /** 646 | * Creates an object representation of this proto suitable for use in Soy templates. 647 | * Field names that are reserved in JavaScript and will be renamed to pb_name. 648 | * To access a reserved field use, foo.pb_, eg, foo.pb_default. 649 | * For the list of reserved names please see: 650 | * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. 651 | * @param {boolean=} opt_includeInstance Whether to include the JSPB instance 652 | * for transitional soy proto support: http://goto/soy-param-migration 653 | * @return {!Object} 654 | */ 655 | proto.fuzzilli.protobuf.Statistics.prototype.toObject = function(opt_includeInstance) { 656 | return proto.fuzzilli.protobuf.Statistics.toObject(opt_includeInstance, this); 657 | }; 658 | 659 | 660 | /** 661 | * Static version of the {@see toObject} method. 662 | * @param {boolean|undefined} includeInstance Whether to include the JSPB 663 | * instance for transitional soy proto support: 664 | * http://goto/soy-param-migration 665 | * @param {!proto.fuzzilli.protobuf.Statistics} msg The msg instance to transform. 666 | * @return {!Object} 667 | * @suppress {unusedLocalVariables} f is only used for nested messages 668 | */ 669 | proto.fuzzilli.protobuf.Statistics.toObject = function(includeInstance, msg) { 670 | var f, obj = { 671 | totalsamples: jspb.Message.getFieldWithDefault(msg, 1, 0), 672 | validsamples: jspb.Message.getFieldWithDefault(msg, 2, 0), 673 | interestingsamples: jspb.Message.getFieldWithDefault(msg, 3, 0), 674 | timedoutsamples: jspb.Message.getFieldWithDefault(msg, 4, 0), 675 | crashingsamples: jspb.Message.getFieldWithDefault(msg, 5, 0), 676 | totalexecs: jspb.Message.getFieldWithDefault(msg, 6, 0), 677 | avgprogramsize: +jspb.Message.getFieldWithDefault(msg, 7, 0.0), 678 | execspersecond: +jspb.Message.getFieldWithDefault(msg, 8, 0.0), 679 | fuzzeroverhead: +jspb.Message.getFieldWithDefault(msg, 9, 0.0), 680 | numworkers: jspb.Message.getFieldWithDefault(msg, 10, 0), 681 | coverage: +jspb.Message.getFieldWithDefault(msg, 11, 0.0), 682 | interestingsampleswithtypes: jspb.Message.getFieldWithDefault(msg, 12, 0), 683 | typecollectiontimeouts: jspb.Message.getFieldWithDefault(msg, 13, 0), 684 | typecollectionfailures: jspb.Message.getFieldWithDefault(msg, 14, 0), 685 | typecollectionattempts: jspb.Message.getFieldWithDefault(msg, 15, 0) 686 | }; 687 | 688 | if (includeInstance) { 689 | obj.$jspbMessageInstance = msg; 690 | } 691 | return obj; 692 | }; 693 | } 694 | 695 | 696 | /** 697 | * Deserializes binary data (in protobuf wire format). 698 | * @param {jspb.ByteSource} bytes The bytes to deserialize. 699 | * @return {!proto.fuzzilli.protobuf.Statistics} 700 | */ 701 | proto.fuzzilli.protobuf.Statistics.deserializeBinary = function(bytes) { 702 | var reader = new jspb.BinaryReader(bytes); 703 | var msg = new proto.fuzzilli.protobuf.Statistics; 704 | return proto.fuzzilli.protobuf.Statistics.deserializeBinaryFromReader(msg, reader); 705 | }; 706 | 707 | 708 | /** 709 | * Deserializes binary data (in protobuf wire format) from the 710 | * given reader into the given message object. 711 | * @param {!proto.fuzzilli.protobuf.Statistics} msg The message object to deserialize into. 712 | * @param {!jspb.BinaryReader} reader The BinaryReader to use. 713 | * @return {!proto.fuzzilli.protobuf.Statistics} 714 | */ 715 | proto.fuzzilli.protobuf.Statistics.deserializeBinaryFromReader = function(msg, reader) { 716 | while (reader.nextField()) { 717 | if (reader.isEndGroup()) { 718 | break; 719 | } 720 | var field = reader.getFieldNumber(); 721 | switch (field) { 722 | case 1: 723 | var value = /** @type {number} */ (reader.readUint64()); 724 | msg.setTotalsamples(value); 725 | break; 726 | case 2: 727 | var value = /** @type {number} */ (reader.readUint64()); 728 | msg.setValidsamples(value); 729 | break; 730 | case 3: 731 | var value = /** @type {number} */ (reader.readUint64()); 732 | msg.setInterestingsamples(value); 733 | break; 734 | case 4: 735 | var value = /** @type {number} */ (reader.readUint64()); 736 | msg.setTimedoutsamples(value); 737 | break; 738 | case 5: 739 | var value = /** @type {number} */ (reader.readUint64()); 740 | msg.setCrashingsamples(value); 741 | break; 742 | case 6: 743 | var value = /** @type {number} */ (reader.readUint64()); 744 | msg.setTotalexecs(value); 745 | break; 746 | case 7: 747 | var value = /** @type {number} */ (reader.readDouble()); 748 | msg.setAvgprogramsize(value); 749 | break; 750 | case 8: 751 | var value = /** @type {number} */ (reader.readDouble()); 752 | msg.setExecspersecond(value); 753 | break; 754 | case 9: 755 | var value = /** @type {number} */ (reader.readDouble()); 756 | msg.setFuzzeroverhead(value); 757 | break; 758 | case 10: 759 | var value = /** @type {number} */ (reader.readUint64()); 760 | msg.setNumworkers(value); 761 | break; 762 | case 11: 763 | var value = /** @type {number} */ (reader.readDouble()); 764 | msg.setCoverage(value); 765 | break; 766 | case 12: 767 | var value = /** @type {number} */ (reader.readUint64()); 768 | msg.setInterestingsampleswithtypes(value); 769 | break; 770 | case 13: 771 | var value = /** @type {number} */ (reader.readUint64()); 772 | msg.setTypecollectiontimeouts(value); 773 | break; 774 | case 14: 775 | var value = /** @type {number} */ (reader.readUint64()); 776 | msg.setTypecollectionfailures(value); 777 | break; 778 | case 15: 779 | var value = /** @type {number} */ (reader.readUint64()); 780 | msg.setTypecollectionattempts(value); 781 | break; 782 | default: 783 | reader.skipField(); 784 | break; 785 | } 786 | } 787 | return msg; 788 | }; 789 | 790 | 791 | /** 792 | * Serializes the message to binary data (in protobuf wire format). 793 | * @return {!Uint8Array} 794 | */ 795 | proto.fuzzilli.protobuf.Statistics.prototype.serializeBinary = function() { 796 | var writer = new jspb.BinaryWriter(); 797 | proto.fuzzilli.protobuf.Statistics.serializeBinaryToWriter(this, writer); 798 | return writer.getResultBuffer(); 799 | }; 800 | 801 | 802 | /** 803 | * Serializes the given message to binary data (in protobuf wire 804 | * format), writing to the given BinaryWriter. 805 | * @param {!proto.fuzzilli.protobuf.Statistics} message 806 | * @param {!jspb.BinaryWriter} writer 807 | * @suppress {unusedLocalVariables} f is only used for nested messages 808 | */ 809 | proto.fuzzilli.protobuf.Statistics.serializeBinaryToWriter = function(message, writer) { 810 | var f = undefined; 811 | f = message.getTotalsamples(); 812 | if (f !== 0) { 813 | writer.writeUint64( 814 | 1, 815 | f 816 | ); 817 | } 818 | f = message.getValidsamples(); 819 | if (f !== 0) { 820 | writer.writeUint64( 821 | 2, 822 | f 823 | ); 824 | } 825 | f = message.getInterestingsamples(); 826 | if (f !== 0) { 827 | writer.writeUint64( 828 | 3, 829 | f 830 | ); 831 | } 832 | f = message.getTimedoutsamples(); 833 | if (f !== 0) { 834 | writer.writeUint64( 835 | 4, 836 | f 837 | ); 838 | } 839 | f = message.getCrashingsamples(); 840 | if (f !== 0) { 841 | writer.writeUint64( 842 | 5, 843 | f 844 | ); 845 | } 846 | f = message.getTotalexecs(); 847 | if (f !== 0) { 848 | writer.writeUint64( 849 | 6, 850 | f 851 | ); 852 | } 853 | f = message.getAvgprogramsize(); 854 | if (f !== 0.0) { 855 | writer.writeDouble( 856 | 7, 857 | f 858 | ); 859 | } 860 | f = message.getExecspersecond(); 861 | if (f !== 0.0) { 862 | writer.writeDouble( 863 | 8, 864 | f 865 | ); 866 | } 867 | f = message.getFuzzeroverhead(); 868 | if (f !== 0.0) { 869 | writer.writeDouble( 870 | 9, 871 | f 872 | ); 873 | } 874 | f = message.getNumworkers(); 875 | if (f !== 0) { 876 | writer.writeUint64( 877 | 10, 878 | f 879 | ); 880 | } 881 | f = message.getCoverage(); 882 | if (f !== 0.0) { 883 | writer.writeDouble( 884 | 11, 885 | f 886 | ); 887 | } 888 | f = message.getInterestingsampleswithtypes(); 889 | if (f !== 0) { 890 | writer.writeUint64( 891 | 12, 892 | f 893 | ); 894 | } 895 | f = message.getTypecollectiontimeouts(); 896 | if (f !== 0) { 897 | writer.writeUint64( 898 | 13, 899 | f 900 | ); 901 | } 902 | f = message.getTypecollectionfailures(); 903 | if (f !== 0) { 904 | writer.writeUint64( 905 | 14, 906 | f 907 | ); 908 | } 909 | f = message.getTypecollectionattempts(); 910 | if (f !== 0) { 911 | writer.writeUint64( 912 | 15, 913 | f 914 | ); 915 | } 916 | }; 917 | 918 | 919 | /** 920 | * optional uint64 totalSamples = 1; 921 | * @return {number} 922 | */ 923 | proto.fuzzilli.protobuf.Statistics.prototype.getTotalsamples = function() { 924 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); 925 | }; 926 | 927 | 928 | /** @param {number} value */ 929 | proto.fuzzilli.protobuf.Statistics.prototype.setTotalsamples = function(value) { 930 | jspb.Message.setProto3IntField(this, 1, value); 931 | }; 932 | 933 | 934 | /** 935 | * optional uint64 validSamples = 2; 936 | * @return {number} 937 | */ 938 | proto.fuzzilli.protobuf.Statistics.prototype.getValidsamples = function() { 939 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); 940 | }; 941 | 942 | 943 | /** @param {number} value */ 944 | proto.fuzzilli.protobuf.Statistics.prototype.setValidsamples = function(value) { 945 | jspb.Message.setProto3IntField(this, 2, value); 946 | }; 947 | 948 | 949 | /** 950 | * optional uint64 interestingSamples = 3; 951 | * @return {number} 952 | */ 953 | proto.fuzzilli.protobuf.Statistics.prototype.getInterestingsamples = function() { 954 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); 955 | }; 956 | 957 | 958 | /** @param {number} value */ 959 | proto.fuzzilli.protobuf.Statistics.prototype.setInterestingsamples = function(value) { 960 | jspb.Message.setProto3IntField(this, 3, value); 961 | }; 962 | 963 | 964 | /** 965 | * optional uint64 timedOutSamples = 4; 966 | * @return {number} 967 | */ 968 | proto.fuzzilli.protobuf.Statistics.prototype.getTimedoutsamples = function() { 969 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); 970 | }; 971 | 972 | 973 | /** @param {number} value */ 974 | proto.fuzzilli.protobuf.Statistics.prototype.setTimedoutsamples = function(value) { 975 | jspb.Message.setProto3IntField(this, 4, value); 976 | }; 977 | 978 | 979 | /** 980 | * optional uint64 crashingSamples = 5; 981 | * @return {number} 982 | */ 983 | proto.fuzzilli.protobuf.Statistics.prototype.getCrashingsamples = function() { 984 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); 985 | }; 986 | 987 | 988 | /** @param {number} value */ 989 | proto.fuzzilli.protobuf.Statistics.prototype.setCrashingsamples = function(value) { 990 | jspb.Message.setProto3IntField(this, 5, value); 991 | }; 992 | 993 | 994 | /** 995 | * optional uint64 totalExecs = 6; 996 | * @return {number} 997 | */ 998 | proto.fuzzilli.protobuf.Statistics.prototype.getTotalexecs = function() { 999 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); 1000 | }; 1001 | 1002 | 1003 | /** @param {number} value */ 1004 | proto.fuzzilli.protobuf.Statistics.prototype.setTotalexecs = function(value) { 1005 | jspb.Message.setProto3IntField(this, 6, value); 1006 | }; 1007 | 1008 | 1009 | /** 1010 | * optional double avgProgramSize = 7; 1011 | * @return {number} 1012 | */ 1013 | proto.fuzzilli.protobuf.Statistics.prototype.getAvgprogramsize = function() { 1014 | return /** @type {number} */ (+jspb.Message.getFieldWithDefault(this, 7, 0.0)); 1015 | }; 1016 | 1017 | 1018 | /** @param {number} value */ 1019 | proto.fuzzilli.protobuf.Statistics.prototype.setAvgprogramsize = function(value) { 1020 | jspb.Message.setProto3FloatField(this, 7, value); 1021 | }; 1022 | 1023 | 1024 | /** 1025 | * optional double execsPerSecond = 8; 1026 | * @return {number} 1027 | */ 1028 | proto.fuzzilli.protobuf.Statistics.prototype.getExecspersecond = function() { 1029 | return /** @type {number} */ (+jspb.Message.getFieldWithDefault(this, 8, 0.0)); 1030 | }; 1031 | 1032 | 1033 | /** @param {number} value */ 1034 | proto.fuzzilli.protobuf.Statistics.prototype.setExecspersecond = function(value) { 1035 | jspb.Message.setProto3FloatField(this, 8, value); 1036 | }; 1037 | 1038 | 1039 | /** 1040 | * optional double fuzzerOverhead = 9; 1041 | * @return {number} 1042 | */ 1043 | proto.fuzzilli.protobuf.Statistics.prototype.getFuzzeroverhead = function() { 1044 | return /** @type {number} */ (+jspb.Message.getFieldWithDefault(this, 9, 0.0)); 1045 | }; 1046 | 1047 | 1048 | /** @param {number} value */ 1049 | proto.fuzzilli.protobuf.Statistics.prototype.setFuzzeroverhead = function(value) { 1050 | jspb.Message.setProto3FloatField(this, 9, value); 1051 | }; 1052 | 1053 | 1054 | /** 1055 | * optional uint64 numWorkers = 10; 1056 | * @return {number} 1057 | */ 1058 | proto.fuzzilli.protobuf.Statistics.prototype.getNumworkers = function() { 1059 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 10, 0)); 1060 | }; 1061 | 1062 | 1063 | /** @param {number} value */ 1064 | proto.fuzzilli.protobuf.Statistics.prototype.setNumworkers = function(value) { 1065 | jspb.Message.setProto3IntField(this, 10, value); 1066 | }; 1067 | 1068 | 1069 | /** 1070 | * optional double coverage = 11; 1071 | * @return {number} 1072 | */ 1073 | proto.fuzzilli.protobuf.Statistics.prototype.getCoverage = function() { 1074 | return /** @type {number} */ (+jspb.Message.getFieldWithDefault(this, 11, 0.0)); 1075 | }; 1076 | 1077 | 1078 | /** @param {number} value */ 1079 | proto.fuzzilli.protobuf.Statistics.prototype.setCoverage = function(value) { 1080 | jspb.Message.setProto3FloatField(this, 11, value); 1081 | }; 1082 | 1083 | 1084 | /** 1085 | * optional uint64 interestingSamplesWithTypes = 12; 1086 | * @return {number} 1087 | */ 1088 | proto.fuzzilli.protobuf.Statistics.prototype.getInterestingsampleswithtypes = function() { 1089 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 12, 0)); 1090 | }; 1091 | 1092 | 1093 | /** @param {number} value */ 1094 | proto.fuzzilli.protobuf.Statistics.prototype.setInterestingsampleswithtypes = function(value) { 1095 | jspb.Message.setProto3IntField(this, 12, value); 1096 | }; 1097 | 1098 | 1099 | /** 1100 | * optional uint64 typeCollectionTimeouts = 13; 1101 | * @return {number} 1102 | */ 1103 | proto.fuzzilli.protobuf.Statistics.prototype.getTypecollectiontimeouts = function() { 1104 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 13, 0)); 1105 | }; 1106 | 1107 | 1108 | /** @param {number} value */ 1109 | proto.fuzzilli.protobuf.Statistics.prototype.setTypecollectiontimeouts = function(value) { 1110 | jspb.Message.setProto3IntField(this, 13, value); 1111 | }; 1112 | 1113 | 1114 | /** 1115 | * optional uint64 typeCollectionFailures = 14; 1116 | * @return {number} 1117 | */ 1118 | proto.fuzzilli.protobuf.Statistics.prototype.getTypecollectionfailures = function() { 1119 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 14, 0)); 1120 | }; 1121 | 1122 | 1123 | /** @param {number} value */ 1124 | proto.fuzzilli.protobuf.Statistics.prototype.setTypecollectionfailures = function(value) { 1125 | jspb.Message.setProto3IntField(this, 14, value); 1126 | }; 1127 | 1128 | 1129 | /** 1130 | * optional uint64 typeCollectionAttempts = 15; 1131 | * @return {number} 1132 | */ 1133 | proto.fuzzilli.protobuf.Statistics.prototype.getTypecollectionattempts = function() { 1134 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 15, 0)); 1135 | }; 1136 | 1137 | 1138 | /** @param {number} value */ 1139 | proto.fuzzilli.protobuf.Statistics.prototype.setTypecollectionattempts = function(value) { 1140 | jspb.Message.setProto3IntField(this, 15, value); 1141 | }; 1142 | 1143 | 1144 | goog.object.extend(exports, proto.fuzzilli.protobuf); 1145 | -------------------------------------------------------------------------------- /proto/typesystem_pb.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview 3 | * @enhanceable 4 | * @suppress {messageConventions} JS Compiler reports an error if a variable or 5 | * field starts with 'MSG_' and isn't a translatable message. 6 | * @public 7 | */ 8 | // GENERATED CODE -- DO NOT EDIT! 9 | 10 | var jspb = require('google-protobuf'); 11 | var goog = jspb; 12 | var global = Function('return this')(); 13 | 14 | goog.exportSymbol('proto.fuzzilli.protobuf.FunctionSignature', null, global); 15 | goog.exportSymbol('proto.fuzzilli.protobuf.Type', null, global); 16 | goog.exportSymbol('proto.fuzzilli.protobuf.TypeExtension', null, global); 17 | 18 | /** 19 | * Generated by JsPbCodeGenerator. 20 | * @param {Array=} opt_data Optional initial data array, typically from a 21 | * server response, or constructed directly in Javascript. The array is used 22 | * in place and becomes part of the constructed object. It is not cloned. 23 | * If no data is provided, the constructed object will be empty, but still 24 | * valid. 25 | * @extends {jspb.Message} 26 | * @constructor 27 | */ 28 | proto.fuzzilli.protobuf.Type = function(opt_data) { 29 | jspb.Message.initialize(this, opt_data, 0, -1, null, proto.fuzzilli.protobuf.Type.oneofGroups_); 30 | }; 31 | goog.inherits(proto.fuzzilli.protobuf.Type, jspb.Message); 32 | if (goog.DEBUG && !COMPILED) { 33 | proto.fuzzilli.protobuf.Type.displayName = 'proto.fuzzilli.protobuf.Type'; 34 | } 35 | /** 36 | * Oneof group definitions for this message. Each group defines the field 37 | * numbers belonging to that group. When of these fields' value is set, all 38 | * other fields in the group are cleared. During deserialization, if multiple 39 | * fields are encountered for a group, only the last value seen will be kept. 40 | * @private {!Array>} 41 | * @const 42 | */ 43 | proto.fuzzilli.protobuf.Type.oneofGroups_ = [[3,4]]; 44 | 45 | /** 46 | * @enum {number} 47 | */ 48 | proto.fuzzilli.protobuf.Type.ExtCase = { 49 | EXT_NOT_SET: 0, 50 | EXTENSIONIDX: 3, 51 | EXTENSION: 4 52 | }; 53 | 54 | /** 55 | * @return {proto.fuzzilli.protobuf.Type.ExtCase} 56 | */ 57 | proto.fuzzilli.protobuf.Type.prototype.getExtCase = function() { 58 | return /** @type {proto.fuzzilli.protobuf.Type.ExtCase} */(jspb.Message.computeOneofCase(this, proto.fuzzilli.protobuf.Type.oneofGroups_[0])); 59 | }; 60 | 61 | 62 | 63 | if (jspb.Message.GENERATE_TO_OBJECT) { 64 | /** 65 | * Creates an object representation of this proto suitable for use in Soy templates. 66 | * Field names that are reserved in JavaScript and will be renamed to pb_name. 67 | * To access a reserved field use, foo.pb_, eg, foo.pb_default. 68 | * For the list of reserved names please see: 69 | * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. 70 | * @param {boolean=} opt_includeInstance Whether to include the JSPB instance 71 | * for transitional soy proto support: http://goto/soy-param-migration 72 | * @return {!Object} 73 | */ 74 | proto.fuzzilli.protobuf.Type.prototype.toObject = function(opt_includeInstance) { 75 | return proto.fuzzilli.protobuf.Type.toObject(opt_includeInstance, this); 76 | }; 77 | 78 | 79 | /** 80 | * Static version of the {@see toObject} method. 81 | * @param {boolean|undefined} includeInstance Whether to include the JSPB 82 | * instance for transitional soy proto support: 83 | * http://goto/soy-param-migration 84 | * @param {!proto.fuzzilli.protobuf.Type} msg The msg instance to transform. 85 | * @return {!Object} 86 | * @suppress {unusedLocalVariables} f is only used for nested messages 87 | */ 88 | proto.fuzzilli.protobuf.Type.toObject = function(includeInstance, msg) { 89 | var f, obj = { 90 | definitetype: jspb.Message.getFieldWithDefault(msg, 1, 0), 91 | possibletype: jspb.Message.getFieldWithDefault(msg, 2, 0), 92 | extensionidx: jspb.Message.getFieldWithDefault(msg, 3, 0), 93 | extension: (f = msg.getExtension$()) && proto.fuzzilli.protobuf.TypeExtension.toObject(includeInstance, f) 94 | }; 95 | 96 | if (includeInstance) { 97 | obj.$jspbMessageInstance = msg; 98 | } 99 | return obj; 100 | }; 101 | } 102 | 103 | 104 | /** 105 | * Deserializes binary data (in protobuf wire format). 106 | * @param {jspb.ByteSource} bytes The bytes to deserialize. 107 | * @return {!proto.fuzzilli.protobuf.Type} 108 | */ 109 | proto.fuzzilli.protobuf.Type.deserializeBinary = function(bytes) { 110 | var reader = new jspb.BinaryReader(bytes); 111 | var msg = new proto.fuzzilli.protobuf.Type; 112 | return proto.fuzzilli.protobuf.Type.deserializeBinaryFromReader(msg, reader); 113 | }; 114 | 115 | 116 | /** 117 | * Deserializes binary data (in protobuf wire format) from the 118 | * given reader into the given message object. 119 | * @param {!proto.fuzzilli.protobuf.Type} msg The message object to deserialize into. 120 | * @param {!jspb.BinaryReader} reader The BinaryReader to use. 121 | * @return {!proto.fuzzilli.protobuf.Type} 122 | */ 123 | proto.fuzzilli.protobuf.Type.deserializeBinaryFromReader = function(msg, reader) { 124 | while (reader.nextField()) { 125 | if (reader.isEndGroup()) { 126 | break; 127 | } 128 | var field = reader.getFieldNumber(); 129 | switch (field) { 130 | case 1: 131 | var value = /** @type {number} */ (reader.readUint32()); 132 | msg.setDefinitetype(value); 133 | break; 134 | case 2: 135 | var value = /** @type {number} */ (reader.readUint32()); 136 | msg.setPossibletype(value); 137 | break; 138 | case 3: 139 | var value = /** @type {number} */ (reader.readUint32()); 140 | msg.setExtensionidx(value); 141 | break; 142 | case 4: 143 | var value = new proto.fuzzilli.protobuf.TypeExtension; 144 | reader.readMessage(value,proto.fuzzilli.protobuf.TypeExtension.deserializeBinaryFromReader); 145 | msg.setExtension$(value); 146 | break; 147 | default: 148 | reader.skipField(); 149 | break; 150 | } 151 | } 152 | return msg; 153 | }; 154 | 155 | 156 | /** 157 | * Serializes the message to binary data (in protobuf wire format). 158 | * @return {!Uint8Array} 159 | */ 160 | proto.fuzzilli.protobuf.Type.prototype.serializeBinary = function() { 161 | var writer = new jspb.BinaryWriter(); 162 | proto.fuzzilli.protobuf.Type.serializeBinaryToWriter(this, writer); 163 | return writer.getResultBuffer(); 164 | }; 165 | 166 | 167 | /** 168 | * Serializes the given message to binary data (in protobuf wire 169 | * format), writing to the given BinaryWriter. 170 | * @param {!proto.fuzzilli.protobuf.Type} message 171 | * @param {!jspb.BinaryWriter} writer 172 | * @suppress {unusedLocalVariables} f is only used for nested messages 173 | */ 174 | proto.fuzzilli.protobuf.Type.serializeBinaryToWriter = function(message, writer) { 175 | var f = undefined; 176 | f = message.getDefinitetype(); 177 | if (f !== 0) { 178 | writer.writeUint32( 179 | 1, 180 | f 181 | ); 182 | } 183 | f = message.getPossibletype(); 184 | if (f !== 0) { 185 | writer.writeUint32( 186 | 2, 187 | f 188 | ); 189 | } 190 | f = /** @type {number} */ (jspb.Message.getField(message, 3)); 191 | if (f != null) { 192 | writer.writeUint32( 193 | 3, 194 | f 195 | ); 196 | } 197 | f = message.getExtension$(); 198 | if (f != null) { 199 | writer.writeMessage( 200 | 4, 201 | f, 202 | proto.fuzzilli.protobuf.TypeExtension.serializeBinaryToWriter 203 | ); 204 | } 205 | }; 206 | 207 | 208 | /** 209 | * optional uint32 definiteType = 1; 210 | * @return {number} 211 | */ 212 | proto.fuzzilli.protobuf.Type.prototype.getDefinitetype = function() { 213 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); 214 | }; 215 | 216 | 217 | /** @param {number} value */ 218 | proto.fuzzilli.protobuf.Type.prototype.setDefinitetype = function(value) { 219 | jspb.Message.setProto3IntField(this, 1, value); 220 | }; 221 | 222 | 223 | /** 224 | * optional uint32 possibleType = 2; 225 | * @return {number} 226 | */ 227 | proto.fuzzilli.protobuf.Type.prototype.getPossibletype = function() { 228 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); 229 | }; 230 | 231 | 232 | /** @param {number} value */ 233 | proto.fuzzilli.protobuf.Type.prototype.setPossibletype = function(value) { 234 | jspb.Message.setProto3IntField(this, 2, value); 235 | }; 236 | 237 | 238 | /** 239 | * optional uint32 extensionIdx = 3; 240 | * @return {number} 241 | */ 242 | proto.fuzzilli.protobuf.Type.prototype.getExtensionidx = function() { 243 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); 244 | }; 245 | 246 | 247 | /** @param {number} value */ 248 | proto.fuzzilli.protobuf.Type.prototype.setExtensionidx = function(value) { 249 | jspb.Message.setOneofField(this, 3, proto.fuzzilli.protobuf.Type.oneofGroups_[0], value); 250 | }; 251 | 252 | 253 | proto.fuzzilli.protobuf.Type.prototype.clearExtensionidx = function() { 254 | jspb.Message.setOneofField(this, 3, proto.fuzzilli.protobuf.Type.oneofGroups_[0], undefined); 255 | }; 256 | 257 | 258 | /** 259 | * Returns whether this field is set. 260 | * @return {!boolean} 261 | */ 262 | proto.fuzzilli.protobuf.Type.prototype.hasExtensionidx = function() { 263 | return jspb.Message.getField(this, 3) != null; 264 | }; 265 | 266 | 267 | /** 268 | * optional TypeExtension extension = 4; 269 | * @return {?proto.fuzzilli.protobuf.TypeExtension} 270 | */ 271 | proto.fuzzilli.protobuf.Type.prototype.getExtension$ = function() { 272 | return /** @type{?proto.fuzzilli.protobuf.TypeExtension} */ ( 273 | jspb.Message.getWrapperField(this, proto.fuzzilli.protobuf.TypeExtension, 4)); 274 | }; 275 | 276 | 277 | /** @param {?proto.fuzzilli.protobuf.TypeExtension|undefined} value */ 278 | proto.fuzzilli.protobuf.Type.prototype.setExtension$ = function(value) { 279 | jspb.Message.setOneofWrapperField(this, 4, proto.fuzzilli.protobuf.Type.oneofGroups_[0], value); 280 | }; 281 | 282 | 283 | proto.fuzzilli.protobuf.Type.prototype.clearExtension$ = function() { 284 | this.setExtension$(undefined); 285 | }; 286 | 287 | 288 | /** 289 | * Returns whether this field is set. 290 | * @return {!boolean} 291 | */ 292 | proto.fuzzilli.protobuf.Type.prototype.hasExtension$ = function() { 293 | return jspb.Message.getField(this, 4) != null; 294 | }; 295 | 296 | 297 | 298 | /** 299 | * Generated by JsPbCodeGenerator. 300 | * @param {Array=} opt_data Optional initial data array, typically from a 301 | * server response, or constructed directly in Javascript. The array is used 302 | * in place and becomes part of the constructed object. It is not cloned. 303 | * If no data is provided, the constructed object will be empty, but still 304 | * valid. 305 | * @extends {jspb.Message} 306 | * @constructor 307 | */ 308 | proto.fuzzilli.protobuf.TypeExtension = function(opt_data) { 309 | jspb.Message.initialize(this, opt_data, 0, -1, proto.fuzzilli.protobuf.TypeExtension.repeatedFields_, null); 310 | }; 311 | goog.inherits(proto.fuzzilli.protobuf.TypeExtension, jspb.Message); 312 | if (goog.DEBUG && !COMPILED) { 313 | proto.fuzzilli.protobuf.TypeExtension.displayName = 'proto.fuzzilli.protobuf.TypeExtension'; 314 | } 315 | /** 316 | * List of repeated fields within this message type. 317 | * @private {!Array} 318 | * @const 319 | */ 320 | proto.fuzzilli.protobuf.TypeExtension.repeatedFields_ = [1,2]; 321 | 322 | 323 | 324 | if (jspb.Message.GENERATE_TO_OBJECT) { 325 | /** 326 | * Creates an object representation of this proto suitable for use in Soy templates. 327 | * Field names that are reserved in JavaScript and will be renamed to pb_name. 328 | * To access a reserved field use, foo.pb_, eg, foo.pb_default. 329 | * For the list of reserved names please see: 330 | * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. 331 | * @param {boolean=} opt_includeInstance Whether to include the JSPB instance 332 | * for transitional soy proto support: http://goto/soy-param-migration 333 | * @return {!Object} 334 | */ 335 | proto.fuzzilli.protobuf.TypeExtension.prototype.toObject = function(opt_includeInstance) { 336 | return proto.fuzzilli.protobuf.TypeExtension.toObject(opt_includeInstance, this); 337 | }; 338 | 339 | 340 | /** 341 | * Static version of the {@see toObject} method. 342 | * @param {boolean|undefined} includeInstance Whether to include the JSPB 343 | * instance for transitional soy proto support: 344 | * http://goto/soy-param-migration 345 | * @param {!proto.fuzzilli.protobuf.TypeExtension} msg The msg instance to transform. 346 | * @return {!Object} 347 | * @suppress {unusedLocalVariables} f is only used for nested messages 348 | */ 349 | proto.fuzzilli.protobuf.TypeExtension.toObject = function(includeInstance, msg) { 350 | var f, obj = { 351 | propertiesList: jspb.Message.getRepeatedField(msg, 1), 352 | methodsList: jspb.Message.getRepeatedField(msg, 2), 353 | group: jspb.Message.getFieldWithDefault(msg, 3, ""), 354 | signature: (f = msg.getSignature()) && proto.fuzzilli.protobuf.FunctionSignature.toObject(includeInstance, f) 355 | }; 356 | 357 | if (includeInstance) { 358 | obj.$jspbMessageInstance = msg; 359 | } 360 | return obj; 361 | }; 362 | } 363 | 364 | 365 | /** 366 | * Deserializes binary data (in protobuf wire format). 367 | * @param {jspb.ByteSource} bytes The bytes to deserialize. 368 | * @return {!proto.fuzzilli.protobuf.TypeExtension} 369 | */ 370 | proto.fuzzilli.protobuf.TypeExtension.deserializeBinary = function(bytes) { 371 | var reader = new jspb.BinaryReader(bytes); 372 | var msg = new proto.fuzzilli.protobuf.TypeExtension; 373 | return proto.fuzzilli.protobuf.TypeExtension.deserializeBinaryFromReader(msg, reader); 374 | }; 375 | 376 | 377 | /** 378 | * Deserializes binary data (in protobuf wire format) from the 379 | * given reader into the given message object. 380 | * @param {!proto.fuzzilli.protobuf.TypeExtension} msg The message object to deserialize into. 381 | * @param {!jspb.BinaryReader} reader The BinaryReader to use. 382 | * @return {!proto.fuzzilli.protobuf.TypeExtension} 383 | */ 384 | proto.fuzzilli.protobuf.TypeExtension.deserializeBinaryFromReader = function(msg, reader) { 385 | while (reader.nextField()) { 386 | if (reader.isEndGroup()) { 387 | break; 388 | } 389 | var field = reader.getFieldNumber(); 390 | switch (field) { 391 | case 1: 392 | var value = /** @type {string} */ (reader.readString()); 393 | msg.addProperties(value); 394 | break; 395 | case 2: 396 | var value = /** @type {string} */ (reader.readString()); 397 | msg.addMethods(value); 398 | break; 399 | case 3: 400 | var value = /** @type {string} */ (reader.readString()); 401 | msg.setGroup(value); 402 | break; 403 | case 4: 404 | var value = new proto.fuzzilli.protobuf.FunctionSignature; 405 | reader.readMessage(value,proto.fuzzilli.protobuf.FunctionSignature.deserializeBinaryFromReader); 406 | msg.setSignature(value); 407 | break; 408 | default: 409 | reader.skipField(); 410 | break; 411 | } 412 | } 413 | return msg; 414 | }; 415 | 416 | 417 | /** 418 | * Serializes the message to binary data (in protobuf wire format). 419 | * @return {!Uint8Array} 420 | */ 421 | proto.fuzzilli.protobuf.TypeExtension.prototype.serializeBinary = function() { 422 | var writer = new jspb.BinaryWriter(); 423 | proto.fuzzilli.protobuf.TypeExtension.serializeBinaryToWriter(this, writer); 424 | return writer.getResultBuffer(); 425 | }; 426 | 427 | 428 | /** 429 | * Serializes the given message to binary data (in protobuf wire 430 | * format), writing to the given BinaryWriter. 431 | * @param {!proto.fuzzilli.protobuf.TypeExtension} message 432 | * @param {!jspb.BinaryWriter} writer 433 | * @suppress {unusedLocalVariables} f is only used for nested messages 434 | */ 435 | proto.fuzzilli.protobuf.TypeExtension.serializeBinaryToWriter = function(message, writer) { 436 | var f = undefined; 437 | f = message.getPropertiesList(); 438 | if (f.length > 0) { 439 | writer.writeRepeatedString( 440 | 1, 441 | f 442 | ); 443 | } 444 | f = message.getMethodsList(); 445 | if (f.length > 0) { 446 | writer.writeRepeatedString( 447 | 2, 448 | f 449 | ); 450 | } 451 | f = message.getGroup(); 452 | if (f.length > 0) { 453 | writer.writeString( 454 | 3, 455 | f 456 | ); 457 | } 458 | f = message.getSignature(); 459 | if (f != null) { 460 | writer.writeMessage( 461 | 4, 462 | f, 463 | proto.fuzzilli.protobuf.FunctionSignature.serializeBinaryToWriter 464 | ); 465 | } 466 | }; 467 | 468 | 469 | /** 470 | * repeated string properties = 1; 471 | * @return {!Array} 472 | */ 473 | proto.fuzzilli.protobuf.TypeExtension.prototype.getPropertiesList = function() { 474 | return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); 475 | }; 476 | 477 | 478 | /** @param {!Array} value */ 479 | proto.fuzzilli.protobuf.TypeExtension.prototype.setPropertiesList = function(value) { 480 | jspb.Message.setField(this, 1, value || []); 481 | }; 482 | 483 | 484 | /** 485 | * @param {!string} value 486 | * @param {number=} opt_index 487 | */ 488 | proto.fuzzilli.protobuf.TypeExtension.prototype.addProperties = function(value, opt_index) { 489 | jspb.Message.addToRepeatedField(this, 1, value, opt_index); 490 | }; 491 | 492 | 493 | proto.fuzzilli.protobuf.TypeExtension.prototype.clearPropertiesList = function() { 494 | this.setPropertiesList([]); 495 | }; 496 | 497 | 498 | /** 499 | * repeated string methods = 2; 500 | * @return {!Array} 501 | */ 502 | proto.fuzzilli.protobuf.TypeExtension.prototype.getMethodsList = function() { 503 | return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); 504 | }; 505 | 506 | 507 | /** @param {!Array} value */ 508 | proto.fuzzilli.protobuf.TypeExtension.prototype.setMethodsList = function(value) { 509 | jspb.Message.setField(this, 2, value || []); 510 | }; 511 | 512 | 513 | /** 514 | * @param {!string} value 515 | * @param {number=} opt_index 516 | */ 517 | proto.fuzzilli.protobuf.TypeExtension.prototype.addMethods = function(value, opt_index) { 518 | jspb.Message.addToRepeatedField(this, 2, value, opt_index); 519 | }; 520 | 521 | 522 | proto.fuzzilli.protobuf.TypeExtension.prototype.clearMethodsList = function() { 523 | this.setMethodsList([]); 524 | }; 525 | 526 | 527 | /** 528 | * optional string group = 3; 529 | * @return {string} 530 | */ 531 | proto.fuzzilli.protobuf.TypeExtension.prototype.getGroup = function() { 532 | return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); 533 | }; 534 | 535 | 536 | /** @param {string} value */ 537 | proto.fuzzilli.protobuf.TypeExtension.prototype.setGroup = function(value) { 538 | jspb.Message.setProto3StringField(this, 3, value); 539 | }; 540 | 541 | 542 | /** 543 | * optional FunctionSignature signature = 4; 544 | * @return {?proto.fuzzilli.protobuf.FunctionSignature} 545 | */ 546 | proto.fuzzilli.protobuf.TypeExtension.prototype.getSignature = function() { 547 | return /** @type{?proto.fuzzilli.protobuf.FunctionSignature} */ ( 548 | jspb.Message.getWrapperField(this, proto.fuzzilli.protobuf.FunctionSignature, 4)); 549 | }; 550 | 551 | 552 | /** @param {?proto.fuzzilli.protobuf.FunctionSignature|undefined} value */ 553 | proto.fuzzilli.protobuf.TypeExtension.prototype.setSignature = function(value) { 554 | jspb.Message.setWrapperField(this, 4, value); 555 | }; 556 | 557 | 558 | proto.fuzzilli.protobuf.TypeExtension.prototype.clearSignature = function() { 559 | this.setSignature(undefined); 560 | }; 561 | 562 | 563 | /** 564 | * Returns whether this field is set. 565 | * @return {!boolean} 566 | */ 567 | proto.fuzzilli.protobuf.TypeExtension.prototype.hasSignature = function() { 568 | return jspb.Message.getField(this, 4) != null; 569 | }; 570 | 571 | 572 | 573 | /** 574 | * Generated by JsPbCodeGenerator. 575 | * @param {Array=} opt_data Optional initial data array, typically from a 576 | * server response, or constructed directly in Javascript. The array is used 577 | * in place and becomes part of the constructed object. It is not cloned. 578 | * If no data is provided, the constructed object will be empty, but still 579 | * valid. 580 | * @extends {jspb.Message} 581 | * @constructor 582 | */ 583 | proto.fuzzilli.protobuf.FunctionSignature = function(opt_data) { 584 | jspb.Message.initialize(this, opt_data, 0, -1, proto.fuzzilli.protobuf.FunctionSignature.repeatedFields_, null); 585 | }; 586 | goog.inherits(proto.fuzzilli.protobuf.FunctionSignature, jspb.Message); 587 | if (goog.DEBUG && !COMPILED) { 588 | proto.fuzzilli.protobuf.FunctionSignature.displayName = 'proto.fuzzilli.protobuf.FunctionSignature'; 589 | } 590 | /** 591 | * List of repeated fields within this message type. 592 | * @private {!Array} 593 | * @const 594 | */ 595 | proto.fuzzilli.protobuf.FunctionSignature.repeatedFields_ = [1]; 596 | 597 | 598 | 599 | if (jspb.Message.GENERATE_TO_OBJECT) { 600 | /** 601 | * Creates an object representation of this proto suitable for use in Soy templates. 602 | * Field names that are reserved in JavaScript and will be renamed to pb_name. 603 | * To access a reserved field use, foo.pb_, eg, foo.pb_default. 604 | * For the list of reserved names please see: 605 | * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. 606 | * @param {boolean=} opt_includeInstance Whether to include the JSPB instance 607 | * for transitional soy proto support: http://goto/soy-param-migration 608 | * @return {!Object} 609 | */ 610 | proto.fuzzilli.protobuf.FunctionSignature.prototype.toObject = function(opt_includeInstance) { 611 | return proto.fuzzilli.protobuf.FunctionSignature.toObject(opt_includeInstance, this); 612 | }; 613 | 614 | 615 | /** 616 | * Static version of the {@see toObject} method. 617 | * @param {boolean|undefined} includeInstance Whether to include the JSPB 618 | * instance for transitional soy proto support: 619 | * http://goto/soy-param-migration 620 | * @param {!proto.fuzzilli.protobuf.FunctionSignature} msg The msg instance to transform. 621 | * @return {!Object} 622 | * @suppress {unusedLocalVariables} f is only used for nested messages 623 | */ 624 | proto.fuzzilli.protobuf.FunctionSignature.toObject = function(includeInstance, msg) { 625 | var f, obj = { 626 | inputtypesList: jspb.Message.toObjectList(msg.getInputtypesList(), 627 | proto.fuzzilli.protobuf.Type.toObject, includeInstance), 628 | outputtype: (f = msg.getOutputtype()) && proto.fuzzilli.protobuf.Type.toObject(includeInstance, f) 629 | }; 630 | 631 | if (includeInstance) { 632 | obj.$jspbMessageInstance = msg; 633 | } 634 | return obj; 635 | }; 636 | } 637 | 638 | 639 | /** 640 | * Deserializes binary data (in protobuf wire format). 641 | * @param {jspb.ByteSource} bytes The bytes to deserialize. 642 | * @return {!proto.fuzzilli.protobuf.FunctionSignature} 643 | */ 644 | proto.fuzzilli.protobuf.FunctionSignature.deserializeBinary = function(bytes) { 645 | var reader = new jspb.BinaryReader(bytes); 646 | var msg = new proto.fuzzilli.protobuf.FunctionSignature; 647 | return proto.fuzzilli.protobuf.FunctionSignature.deserializeBinaryFromReader(msg, reader); 648 | }; 649 | 650 | 651 | /** 652 | * Deserializes binary data (in protobuf wire format) from the 653 | * given reader into the given message object. 654 | * @param {!proto.fuzzilli.protobuf.FunctionSignature} msg The message object to deserialize into. 655 | * @param {!jspb.BinaryReader} reader The BinaryReader to use. 656 | * @return {!proto.fuzzilli.protobuf.FunctionSignature} 657 | */ 658 | proto.fuzzilli.protobuf.FunctionSignature.deserializeBinaryFromReader = function(msg, reader) { 659 | while (reader.nextField()) { 660 | if (reader.isEndGroup()) { 661 | break; 662 | } 663 | var field = reader.getFieldNumber(); 664 | switch (field) { 665 | case 1: 666 | var value = new proto.fuzzilli.protobuf.Type; 667 | reader.readMessage(value,proto.fuzzilli.protobuf.Type.deserializeBinaryFromReader); 668 | msg.addInputtypes(value); 669 | break; 670 | case 2: 671 | var value = new proto.fuzzilli.protobuf.Type; 672 | reader.readMessage(value,proto.fuzzilli.protobuf.Type.deserializeBinaryFromReader); 673 | msg.setOutputtype(value); 674 | break; 675 | default: 676 | reader.skipField(); 677 | break; 678 | } 679 | } 680 | return msg; 681 | }; 682 | 683 | 684 | /** 685 | * Serializes the message to binary data (in protobuf wire format). 686 | * @return {!Uint8Array} 687 | */ 688 | proto.fuzzilli.protobuf.FunctionSignature.prototype.serializeBinary = function() { 689 | var writer = new jspb.BinaryWriter(); 690 | proto.fuzzilli.protobuf.FunctionSignature.serializeBinaryToWriter(this, writer); 691 | return writer.getResultBuffer(); 692 | }; 693 | 694 | 695 | /** 696 | * Serializes the given message to binary data (in protobuf wire 697 | * format), writing to the given BinaryWriter. 698 | * @param {!proto.fuzzilli.protobuf.FunctionSignature} message 699 | * @param {!jspb.BinaryWriter} writer 700 | * @suppress {unusedLocalVariables} f is only used for nested messages 701 | */ 702 | proto.fuzzilli.protobuf.FunctionSignature.serializeBinaryToWriter = function(message, writer) { 703 | var f = undefined; 704 | f = message.getInputtypesList(); 705 | if (f.length > 0) { 706 | writer.writeRepeatedMessage( 707 | 1, 708 | f, 709 | proto.fuzzilli.protobuf.Type.serializeBinaryToWriter 710 | ); 711 | } 712 | f = message.getOutputtype(); 713 | if (f != null) { 714 | writer.writeMessage( 715 | 2, 716 | f, 717 | proto.fuzzilli.protobuf.Type.serializeBinaryToWriter 718 | ); 719 | } 720 | }; 721 | 722 | 723 | /** 724 | * repeated Type inputTypes = 1; 725 | * @return {!Array} 726 | */ 727 | proto.fuzzilli.protobuf.FunctionSignature.prototype.getInputtypesList = function() { 728 | return /** @type{!Array} */ ( 729 | jspb.Message.getRepeatedWrapperField(this, proto.fuzzilli.protobuf.Type, 1)); 730 | }; 731 | 732 | 733 | /** @param {!Array} value */ 734 | proto.fuzzilli.protobuf.FunctionSignature.prototype.setInputtypesList = function(value) { 735 | jspb.Message.setRepeatedWrapperField(this, 1, value); 736 | }; 737 | 738 | 739 | /** 740 | * @param {!proto.fuzzilli.protobuf.Type=} opt_value 741 | * @param {number=} opt_index 742 | * @return {!proto.fuzzilli.protobuf.Type} 743 | */ 744 | proto.fuzzilli.protobuf.FunctionSignature.prototype.addInputtypes = function(opt_value, opt_index) { 745 | return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.fuzzilli.protobuf.Type, opt_index); 746 | }; 747 | 748 | 749 | proto.fuzzilli.protobuf.FunctionSignature.prototype.clearInputtypesList = function() { 750 | this.setInputtypesList([]); 751 | }; 752 | 753 | 754 | /** 755 | * optional Type outputType = 2; 756 | * @return {?proto.fuzzilli.protobuf.Type} 757 | */ 758 | proto.fuzzilli.protobuf.FunctionSignature.prototype.getOutputtype = function() { 759 | return /** @type{?proto.fuzzilli.protobuf.Type} */ ( 760 | jspb.Message.getWrapperField(this, proto.fuzzilli.protobuf.Type, 2)); 761 | }; 762 | 763 | 764 | /** @param {?proto.fuzzilli.protobuf.Type|undefined} value */ 765 | proto.fuzzilli.protobuf.FunctionSignature.prototype.setOutputtype = function(value) { 766 | jspb.Message.setWrapperField(this, 2, value); 767 | }; 768 | 769 | 770 | proto.fuzzilli.protobuf.FunctionSignature.prototype.clearOutputtype = function() { 771 | this.setOutputtype(undefined); 772 | }; 773 | 774 | 775 | /** 776 | * Returns whether this field is set. 777 | * @return {!boolean} 778 | */ 779 | proto.fuzzilli.protobuf.FunctionSignature.prototype.hasOutputtype = function() { 780 | return jspb.Message.getField(this, 2) != null; 781 | }; 782 | 783 | 784 | goog.object.extend(exports, proto.fuzzilli.protobuf); 785 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | This compiler compile Javascript source file to Fuzzil intermediate language, encoded in a protobuf. This allows Fuzzil to start execution from a large initial corpus.\ 3 | The aim is to produce correct and shortest Fuzzil IR.\ 4 | I test the compiler on test262 corpus and about 80% pass the test: 5 | - compile to Fuzzil IR 6 | - lift to Javascript 7 | - test the lifted JS 8 | 9 | 10 | # Build 11 | npm install 12 | 13 | # Run 14 | node main.js input.js output.fuzzil.protobuf 15 | 16 | # Effort 17 | Fuzzil have several properties that differs from javascript. which should be carefully handled by compiler: 18 | 1. Fuzzil only have let/const variable, do not have var variable and global variable 19 | 2. Fuzzil demand variable defined before it is used. 20 | 3. One javascript statement may be compiled to several Fuzzil instruction. 21 | ```b=a+(++a)``` should be compiled to 22 | ``` 23 | v0 <- Dup a 24 | v1 <- UnaryOperation '++' a 25 | b <- BinaryOperation '+' v0, v1 26 | ``` 27 | The Dup operation is needed here.\ 28 | We have to compile to shorter Fuzzil, which means we can not generate Dup everywhere. We need a extra pass to track where the Dup is actually needed. 29 | 4. Compiler should compile to shorter Fuzzil, which is better for further mutation.\ 30 | Every hoist generate some additional Fuzzil Instruction. This means we only hoist necessary variables/functions.\ 31 | We can do a use analysis pass to track if there is out-of-scope usage, then only hoist the variable that need hoist. Such as: 32 | ``` 33 | { 34 | x=2 35 | { 36 | var x=10; 37 | var y; 38 | x=0; 39 | } 40 | } 41 | ``` 42 | We do not need to hoist x, but have to hoist y. 43 | 44 | We can sort the function declaration, to minimum the function that need hoisted. Such as: 45 | ``` 46 | function a(){b()} 47 | function b(){c()} 48 | function c(){d()} 49 | function d(){a()} 50 | ``` 51 | In Fuzzil, variable must be defined before use. In the original order of the four functions, b/c/d need to be declared as undefined in the top of the scope. If we sort the functions properly, only one function need to be declared as undefined. -------------------------------------------------------------------------------- /src/builtinGen.js: -------------------------------------------------------------------------------- 1 | const fs=require('fs'); 2 | const runtimeFile= 3 | fs.readFileSync('/root/chrome_study/v86/v8/src/runtime/runtime.h'); 4 | const runtimeRawArray=runtimeFile.toString(). 5 | match(/(F|I)\([A-Z].*,.*,.*\)/g); 6 | outRegexp='/('; 7 | for (let i=0; i=0; i--) { 401 | if (symtab[i].has(variable)) { 402 | if (key==undefined) { 403 | return symtab[i].get(variable); 404 | } else { 405 | return symtab[i].get(variable).get(key); 406 | } 407 | } 408 | } 409 | } 410 | 411 | /** 412 | * @param {Node} pattern 413 | * @param {Node} symtab 414 | * @param {[String]} callStack 415 | * @param {Boolean} use 416 | * @return {undefined} 417 | */ 418 | function processPattern(pattern, symtab, callStack, use) { 419 | switch (pattern.type) { 420 | case 'Identifier': 421 | calleeProperties=getSymtab(symtab, pattern.name); 422 | if (calleeProperties!==undefined&& 423 | calleeProperties.get('type')=='func'&&use) { 424 | for (const [callerScope, callerName] of callStack) { 425 | if (callerScope==calleeProperties.get('declaredIn')) { 426 | callerScope.get(callerName).push(pattern.name); 427 | } 428 | } 429 | } 430 | break; 431 | case 'MemberExpression': 432 | if (pattern.object.type!='Super') { 433 | processExpression(pattern.object, symtab, callStack); 434 | } 435 | if (pattern.computed==true) { 436 | processExpression(pattern.property, symtab, callStack); 437 | } 438 | break; 439 | case 'ObjectPattern': 440 | for (let i=0; i=0; i--) { 555 | // there is no pointer from function name to varsOnScope which is on 556 | // varScope. We backtrace symtab and think the first function declaration we 557 | // meet is the function we want to set. 558 | // This is likely to be correct. 559 | // in the future maybe keep a pointer from hoist pass. 560 | if (symtab[i].has(variable)&& 561 | symtab[i].get(variable).get('type')=='func') { 562 | symtab[i].get(variable).set('loadUndefined', ''); 563 | break; 564 | } 565 | } 566 | } 567 | 568 | /** 569 | * @param {string} type 570 | * @return {undefined} 571 | */ 572 | function exitProgram(type) { 573 | console.log('Not Supported: '+type); 574 | process.exit(139); 575 | } 576 | -------------------------------------------------------------------------------- /src/genProto.js: -------------------------------------------------------------------------------- 1 | require('../proto/operations_pb'); 2 | require('../proto/program_pb'); 3 | require('../proto/typesystem_pb'); 4 | require('../proto/sync_pb'); 5 | 6 | exports.genLoadUndefined=genLoadUndefined; 7 | exports.genLoadInteger=genLoadInteger; 8 | exports.genLoadBoolean=genLoadBoolean; 9 | exports.genLoadString=genLoadString; 10 | exports.genLoadBigInt=genLoadBigInt; 11 | exports.genLoadNull=genLoadNull; 12 | exports.genLoadRegExp=genLoadRegExp; 13 | exports.genCallFunctionWithSpread=genCallFunctionWithSpread; 14 | exports.genCallFunction=genCallFunction; 15 | exports.genCallSuperConstructor=genCallSuperConstructor; 16 | exports.genCreateArrayWithSpread=genCreateArrayWithSpread; 17 | exports.genCreateArray=genCreateArray; 18 | exports.genBeginAnyFunctionDefinition=genBeginAnyFunctionDefinition; 19 | exports.genLoadBuiltin=genLoadBuiltin; 20 | exports.genEndAnyFunctionDefinition=genEndAnyFunctionDefinition; 21 | exports.genReassign=genReassign; 22 | exports.genReturn=genReturn; 23 | exports.genBinaryOperation=genBinaryOperation; 24 | exports.genCompare=genCompare; 25 | exports.genInstanceOf=genInstanceOf; 26 | exports.genIn=genIn; 27 | exports.genCreateObject=genCreateObject; 28 | exports.genCreateObjectWithSpread=genCreateObjectWithSpread; 29 | exports.genTypeOf=genTypeOf; 30 | exports.genBinaryOperationAndReassign=genBinaryOperationAndReassign; 31 | exports.genUnaryOperation=genUnaryOperation; 32 | exports.genLoadProperty=genLoadProperty; 33 | exports.genLoadSuperProperty=genLoadSuperProperty; 34 | exports.genLoadElement=genLoadElement; 35 | exports.genLoadComputedProperty=genLoadComputedProperty; 36 | exports.genStoreSuperProperty=genStoreSuperProperty; 37 | exports.genStoreElement=genStoreElement; 38 | exports.genStoreComputedProperty=genStoreComputedProperty; 39 | exports.genStoreProperty=genStoreProperty; 40 | exports.genConditionalOperation=genConditionalOperation; 41 | exports.genConstruct=genConstruct; 42 | exports.genAwait=genAwait; 43 | exports.genBreak=genBreak; 44 | exports.genConitnue=genConitnue; 45 | exports.genBeginIf=genBeginIf; 46 | exports.genEndIf=genEndIf; 47 | exports.genBeginElse=genBeginElse; 48 | exports.genThrowException=genThrowException; 49 | exports.genYield=genYield; 50 | exports.genBeginBlockStatement=genBeginBlockStatement; 51 | exports.genEndBlockStatement=genEndBlockStatement; 52 | exports.genBeginTry=genBeginTry; 53 | exports.genBeginCatch=genBeginCatch; 54 | exports.genBeginFinally=genBeginFinally; 55 | exports.genEndTryCatch=genEndTryCatch; 56 | exports.genBeginWhile=genBeginWhile; 57 | exports.genEndWhile=genEndWhile; 58 | exports.genEndDoWhile=genEndDoWhile; 59 | exports.genBeginDoWhile=genBeginDoWhile; 60 | exports.genBeginFor=genBeginFor; 61 | exports.genEndFor=genEndFor; 62 | exports.genEndForIn=genEndForIn; 63 | exports.genBeginForIn=genBeginForIn; 64 | exports.genBeginForOf=genBeginForOf; 65 | exports.genEndForOf=genEndForOf; 66 | exports.genCallComputedMethod=genCallComputedMethod; 67 | exports.genCallMethod=genCallMethod; 68 | exports.genLoadFloat=genLoadFloat; 69 | exports.genDup=genDup; 70 | exports.genContinue=genContinue; 71 | // exports.genDeleteProperty=genDeleteProperty; 72 | // exports.genDeleteElement=genDeleteElement; 73 | // exports.genDeleteComputedProperty=genDeleteComputedProperty; 74 | exports.genBeginArrowFunctionDefinition=genBeginArrowFunctionDefinition; 75 | exports.genEndArrowFunctionDefinition=genEndArrowFunctionDefinition; 76 | 77 | /** 78 | * @param {Node[]} IR 79 | * @param {Number[]} inoutList 80 | * @param {Boolean} async 81 | * @return {undefined} 82 | */ 83 | function genBeginArrowFunctionDefinition( 84 | IR, inoutList, async) { 85 | const inst=new proto.fuzzilli.protobuf.Instruction(); 86 | const signature=new proto.fuzzilli.protobuf.FunctionSignature(); 87 | const outType=new proto.fuzzilli.protobuf.Type(); 88 | const inTypeList=[]; 89 | for (let i=0; i': 957 | return proto.fuzzilli.protobuf.Comparator.GREATER_THAN; 958 | case '>=': 959 | return proto.fuzzilli.protobuf.Comparator.GREATER_THAN_OR_EQUAL; 960 | } 961 | } 962 | 963 | 964 | /** 965 | * @param {Node[]} IR 966 | * @param {Number} varNum 967 | * @param {Number} lhs 968 | * @param {Number} rhs 969 | * @param {string} op 970 | * @return {undefined} 971 | */ 972 | function genBinaryOperation(IR, varNum, lhs, rhs, op) { 973 | const inst=new proto.fuzzilli.protobuf.Instruction(); 974 | const binaryOperation= 975 | new proto.fuzzilli.protobuf.BinaryOperation(); 976 | binaryOperation.setOp(operatorToProtoOperator(op)); 977 | inst.setBinaryoperation(binaryOperation); 978 | inst.setInoutsList([lhs, rhs, varNum[0]]); 979 | varNum[0]+=1; 980 | IR.push(inst); 981 | return; 982 | } 983 | 984 | /** 985 | * @param {string} op 986 | * @return {proto.fuzzilli.protobuf.BinaryOperator} 987 | */ 988 | function operatorToProtoOperator(op) { 989 | switch (op) { 990 | case '+': 991 | return proto.fuzzilli.protobuf.BinaryOperator.ADD; 992 | case '-': 993 | return proto.fuzzilli.protobuf.BinaryOperator.SUB; 994 | case '*': 995 | return proto.fuzzilli.protobuf.BinaryOperator.MUL; 996 | case '/': 997 | return proto.fuzzilli.protobuf.BinaryOperator.DIV; 998 | case '%': 999 | return proto.fuzzilli.protobuf.BinaryOperator.MOD; 1000 | case '**': 1001 | return proto.fuzzilli.protobuf.BinaryOperator.EXP; 1002 | case '|': 1003 | return proto.fuzzilli.protobuf.BinaryOperator.BIT_OR; 1004 | case '^': 1005 | return proto.fuzzilli.protobuf.BinaryOperator.XOR; 1006 | case '&': 1007 | return proto.fuzzilli.protobuf.BinaryOperator.BIT_AND; 1008 | case '<<': 1009 | return proto.fuzzilli.protobuf.BinaryOperator.LSHIFT; 1010 | case '>>': 1011 | return proto.fuzzilli.protobuf.BinaryOperator.RSHIFT; 1012 | case '>>>': 1013 | return proto.fuzzilli.protobuf.BinaryOperator.UNRSHIFT; 1014 | case '||': 1015 | return proto.fuzzilli.protobuf.BinaryOperator.LOGICAL_OR; 1016 | case '&&': 1017 | return proto.fuzzilli.protobuf.BinaryOperator.LOGICAL_AND; 1018 | } 1019 | } 1020 | 1021 | /** 1022 | * @param {Node[]} IR 1023 | * @param {Number} varId 1024 | * @return {undefined} 1025 | */ 1026 | function genReturn(IR, varId) { 1027 | const inst=new proto.fuzzilli.protobuf.Instruction(); 1028 | const ret=new proto.fuzzilli.protobuf.Return(); 1029 | inst.setReturn(ret); 1030 | inst.setInoutsList([varId]); 1031 | IR.push(inst); 1032 | return; 1033 | } 1034 | 1035 | /** 1036 | * @param {Node[]} IR 1037 | * @param {Number} lhs 1038 | * @param {Number} rhs 1039 | * @return {undefined} 1040 | */ 1041 | function genReassign(IR, lhs, rhs) { 1042 | const inst=new proto.fuzzilli.protobuf.Instruction(); 1043 | const reassign= 1044 | new proto.fuzzilli.protobuf.Reassign(); 1045 | inst.setReassign(reassign); 1046 | inst.setInoutsList([lhs, rhs]); 1047 | IR.push(inst); 1048 | return; 1049 | } 1050 | 1051 | 1052 | /** 1053 | * @param {Node[]} IR 1054 | * @param {Boolean} async 1055 | * @param {Boolean} generator 1056 | * @return {undefined} 1057 | */ 1058 | function genEndAnyFunctionDefinition(IR, async, generator) { 1059 | const inst=new proto.fuzzilli.protobuf.Instruction(); 1060 | if (async==false&&generator==false) { 1061 | const endFunctionDefination= 1062 | new proto.fuzzilli.protobuf.EndPlainFunctionDefinition(); 1063 | inst.setEndplainfunctiondefinition(endFunctionDefination); 1064 | } else if (async==true&&generator==false) { 1065 | const endFunctionDefination= 1066 | new proto.fuzzilli.protobuf.EndAsyncFunctionDefinition(); 1067 | inst.setEndasyncfunctiondefinition(endFunctionDefination); 1068 | } else if (async==false&&generator==true) { 1069 | const endFunctionDefination= 1070 | new proto.fuzzilli.protobuf.EndGeneratorFunctionDefinition(); 1071 | inst.setEndgeneratorfunctiondefinition(endFunctionDefination); 1072 | } else { 1073 | const endFunctionDefination= 1074 | new proto.fuzzilli.protobuf.EndAsyncGeneratorFunctionDefinition(); 1075 | inst.setEndasyncgeneratorfunctiondefinition(endFunctionDefination); 1076 | } 1077 | IR.push(inst); 1078 | return; 1079 | } 1080 | 1081 | /** 1082 | * @param {Node[]} IR 1083 | * @param {Number[]} varNum 1084 | * @param {Number} objectId 1085 | * @param {String} propertyName 1086 | * @return {undefined} 1087 | */ 1088 | function genLoadProperty(IR, varNum, objectId, propertyName) { 1089 | const inst=new proto.fuzzilli.protobuf.Instruction(); 1090 | const loadProperty= 1091 | new proto.fuzzilli.protobuf.LoadProperty(); 1092 | loadProperty.setPropertyname(propertyName); 1093 | inst.setLoadproperty(loadProperty); 1094 | inst.setInoutsList([objectId, varNum[0]]); 1095 | varNum[0]=varNum[0]+1; 1096 | IR.push(inst); 1097 | return; 1098 | } 1099 | 1100 | /** 1101 | * @param {Node[]} IR 1102 | * @param {Number[]} varNum 1103 | * @param {String} name 1104 | * @return {undefined} 1105 | */ 1106 | function genLoadBuiltin(IR, varNum, name) { 1107 | const inst=new proto.fuzzilli.protobuf.Instruction(); 1108 | const loadBuiltin= 1109 | new proto.fuzzilli.protobuf.LoadBuiltin(); 1110 | loadBuiltin.setBuiltinname(name); 1111 | inst.setLoadbuiltin(loadBuiltin); 1112 | inoutList=[varNum[0]]; 1113 | inst.setInoutsList(inoutList); 1114 | varNum[0]=varNum[0]+1; 1115 | IR.push(inst); 1116 | return; 1117 | } 1118 | 1119 | 1120 | /** 1121 | * @param {Node[]} IR 1122 | * @param {Number[]} inoutList 1123 | * @param {Boolean} async 1124 | * @param {Boolean} generator 1125 | * @param {Boolean} hasRestElement 1126 | * @return {undefined} 1127 | */ 1128 | function genBeginAnyFunctionDefinition( 1129 | IR, inoutList, async, generator, hasRestElement) { 1130 | const inst=new proto.fuzzilli.protobuf.Instruction(); 1131 | const signature=new proto.fuzzilli.protobuf.FunctionSignature(); 1132 | const outType=new proto.fuzzilli.protobuf.Type(); 1133 | const inTypeList=[]; 1134 | for (let i=0; i0&&stmt.body.body[0].directive) { 88 | exitProgram('strict mode function'); 89 | } 90 | letScope.funcInBlock.set(stmt.id.name, []); 91 | // function x(z) { 92 | // console.log(z) 93 | // function z() { } 94 | // } 95 | // 96 | // Need further think about how we want this to compile 97 | // temporarily just bail out here. 98 | if (varScope.varsOnScope.has(stmt.id.name)&& 99 | varScope.varsOnScope.get(stmt.id.name).get('type')!='func') { 100 | exitProgram('argument and parameter same name'); 101 | } 102 | varScope.varsOnScope.set(stmt.id.name, 103 | new Map([['type', 'func'], ['declaredIn', letScope.funcInBlock]])); 104 | stmt.body.varsOnScope=new Map(); 105 | // function arguments(arguments, arguments) { 106 | // console.log(arguments) 107 | // } 108 | // arguments() 109 | // 110 | // arguments is in the function body scope, and we can define same name 111 | // parameter and local variable after. 112 | // this is not exactly the case, such as it is allow to declare a let 113 | // variable inside function, but i think it is currently accurate enough. 114 | stmt.body.varsOnScope.set('arguments', new Map([['type', 'arguments']])); 115 | for (let i=0; i0&&expression.body.body[0].directive) { 293 | exitProgram('strict mode function'); 294 | } 295 | expression.body.varsOnScope=new Map(); 296 | // always have a map, sometimes empty 297 | expression.varsOnScope=new Map(); 298 | expression.body.varsOnScope.set( 299 | 'arguments', new Map([['type', 'arguments']])); 300 | for (let i=0; ireturn a; 313 | if (expression.body.body!==undefined&& 314 | expression.body.body.length>0&&expression.body.body[0].directive) { 315 | exitProgram('strict mode function'); 316 | } 317 | if (expression.expression===false) { 318 | expression.body.varsOnScope=new Map(); 319 | for (let i=0; ireturn a; 310 | if (expression.expression===false) { 311 | initSymtabDeclaredVars(symtab, expression.body); 312 | for (let i=0; i=0; i--) { 560 | if (symtab[i].has(variable)) { 561 | symtab[i].get(variable).set(key, value); 562 | break; 563 | } 564 | } 565 | } 566 | 567 | /** 568 | * @param {Node} symtab 569 | * @param {string} variable 570 | * @param {string} key 571 | * @return {String|Map} 572 | */ 573 | function getSymtab(symtab, variable, key) { 574 | for (let i=symtab.length-1; i>=0; i--) { 575 | if (symtab[i].has(variable)) { 576 | if (key==undefined) { 577 | return symtab[i].get(variable); 578 | } else { 579 | return symtab[i].get(variable).get(key); 580 | } 581 | } 582 | } 583 | } 584 | 585 | /** 586 | * @param {Node} symtab 587 | * @param {string} variable 588 | * @return {Boolean} 589 | */ 590 | function inSymtab(symtab, variable) { 591 | for (let i=symtab.length-1; i>=0; i--) { 592 | if (symtab[i].has(variable)) { 593 | return true; 594 | } 595 | } 596 | return false; 597 | } 598 | 599 | 600 | /** 601 | * @param {Node} symtab 602 | * @param {string} variable 603 | * @return {undefined} 604 | */ 605 | function setLoadUndefined(symtab, variable) { 606 | const type=getSymtab(symtab, variable, 'type'); 607 | if (type=='var'||type=='const'||type=='let'||type=='func'||type=='class') { 608 | setSymtab(symtab, variable, 'loadUndefined', ''); 609 | } 610 | if (type=='func') { 611 | // if hoisted to var scope, then no need to participate the func sort pass 612 | getSymtab(symtab, variable, 'declaredIn').delete(variable); 613 | } 614 | } 615 | /** 616 | * @param {string} type 617 | * @return {undefined} 618 | */ 619 | function exitProgram(type) { 620 | console.log('Not Supported: '+type); 621 | process.exit(139); 622 | } 623 | --------------------------------------------------------------------------------