How to use const_data method in wpt

Best JavaScript code snippet using wpt

array_man.js

Source:array_man.js Github

copy

Full Screen

1var Array_man = {};2var is_node = typeof require !== "undefined";3if (is_node){4 module.exports = Array_man;5 var Zutsuki = require("./zutsuki");6 var Expand = require("./expand");7}8Array_man.P1_Inline = {};9Array_man.P1_Inline.inlining = function(fbody,fcell){10 var ret = [];11 if (Array.isArray(fbody)){12 for (var i=0;i<fbody.length;i++){13 if (fbody[i].type == Zutsuki.TYPE_SYMBOL){14 if (fcell[fbody[i].data]){15 ret.push(fcell[fbody[i].data]);16 }else{17 ret.push(fbody[i]);18 }19 }else{20 ret.push(fbody[i]);21 }22 }23 }else{24 if (fbody.type == Zutsuki.TYPE_SYMBOL){25 if (fcell[fbody.data]){26 ret = fcell[fbody.data];27 }else{28 ret = fbody;29 }30 }else{31 ret = fbody;32 }33 }34 return ret;35}36Array_man.P1_Inline.is_inline_function = function(f){37 if (f[0] == "function"){38 const body = f[3];39 if (f[2]){40 return false;41 }42 for (var i=0;i<body.length;i++){43 if (Array.isArray(body[i])){44 return false;45 }46 }47 }48 return true;49}50Array_man.P1_Inline.is_global_inline_function = function(f,name){51 52 //構文にかかわらずトップ部分がnameになっているか判定する53 var maybe_recursive = false;54 55 function loop(code,nest){56 if (nest > 7){57 return 100;58 }59 if (Array.isArray(code)){60 if (code.length > 10){61 return 100;62 }63 if (code[0] == name){64 maybe_recursive = true;65 }66 var res = 0;67 for (var i=0;i<code.length;i++){68 res += loop(code[i],nest+1);69 }70 return res + 1;71 }72 return 1;73 }74 if (loop(f[3],0) < 20){75 if (maybe_recursive){76 return -1;77 }78 return 1;79 }80 return 0;81}82Array_man.phase_1_is_beta_object = function(object,const_data){83 //quoted value:084 //アトム:185 //手続き:286 if (object.type == Zutsuki.TYPE_CONST_VARIABLE){87 //consta-data88 var c = const_data[object.data];89 if (c[0] == "function"){90 if (Array_man.P1_Inline.is_inline_function(c)){91 return 2;92 }93 return 0;94 }else if (c[0] == "quote"){95 96 return 0;97 }98 return 0;99 }else if (object.type == Zutsuki.TYPE_BOOLEAN){100 return 1;101 }else if (object.type == Zutsuki.TYPE_NUMBER){102 return 1;103 }else if (object.type == Zutsuki.TYPE_SYMBOL){104 return 1;105 }106 return 0;107}108Array_man.phase1_is_conflict_object = function(symbol,stack,global,local_cell){109 var x = 0;110 var new_symbol = symbol;111 while (true){112 var flag = false;113 for (var i=0;i<stack.length;i++){114 if (stack[i][new_symbol]){115 new_symbol = "_$" + x + "_" + symbol + "_";116 x++;117 flag = true;118 break;119 }120 }121 if (flag){122 continue;123 }124 if (global[new_symbol] || local_cell[new_symbol]){125 x++;126 new_symbol = "_" + x + symbol + "_";127 continue;128 }129 break;130 }131 if (x){132 return new_symbol;133 }134 return false;135}136Array_man.phase_1_unconditional_rename = function(symbol,stack,global,local_cell){137 var rsym = symbol + "-renamed";138 var res = Array_man.phase1_is_conflict_object(rsym,stack,global,local_cell);139 if (!res){140 res = rsym;141 }142 return rsym;143}144Array_man.convert_phase_1_let = function(array_man_code1,const_data,global,stack){145 const bindings = array_man_code1[1];146 const free_variables = array_man_code1[5];147 const body = array_man_code1[2];148 const unconditional_renaming = array_man_code1[6];//強制的にrenameさせる(hygenic macroによって)149 if (stack.length>0 && bindings.length == 0){150 return Array_man.convert_phase_1(body,const_data,global,stack);151 }152 const local_cell = {};153 const new_bindings = [];154 if (array_man_code1[3]){155 //bindingsに対して、破壊的変更が行われるケース。156 //いろんな最適化をさせないようにする。157 158 /*159 for (var i=0;i<free_variables.length;i++){160 bindings.push([free_variables[i],Zutsuki.SYM(free_variables[i])]);161 }162 */163 for (var i=0;i<bindings.length;i++){164 bindings[i][1] = Array_man.convert_phase_1(bindings[i][1],const_data,global,stack);165 var gen_sym = null;166 if (unconditional_renaming){167 gen_sym = Array_man.phase_1_unconditional_rename(bindings[i][0],stack,global,local_cell);168 }else{169 gen_sym = Array_man.phase1_is_conflict_object(bindings[i][0],stack,global,local_cell);170 }171 if (gen_sym){172 local_cell[bindings[i][0]] = [3,gen_sym];173 local_cell[gen_sym] = local_cell[bindings[i][0]];174 new_bindings.push([gen_sym,bindings[i][1]]);175 }else{176 local_cell[bindings[i][0]] = Expand.UNDEFINED_OBJECT;177 new_bindings.push(bindings[i]);178 }179 }180 stack.unshift(local_cell);181 array_man_code1[2] = Array_man.convert_phase_1(body,const_data,global,stack);182 stack.shift();183 return ["let2",new_bindings,array_man_code1[2]];184 }else{185 var org_bindings_length = bindings.length;186 //自由変数をbindingsに加える。187 for (var i=0;i<free_variables.length;i++){188 bindings.push([free_variables[i],Zutsuki.SYM(free_variables[i])]);189 }190 191 //一回bindingsを更新する192 for (var i=0;i<bindings.length;i++){193 bindings[i][1] = Array_man.convert_phase_1(bindings[i][1],const_data,global,stack);194 var gen_sym = null;//名前の衝突によってrenameされた識別子195 if (unconditional_renaming){196 gen_sym = Array_man.phase_1_unconditional_rename(bindings[i][0],stack,global,local_cell);197 }else{198 gen_sym = Array_man.phase1_is_conflict_object(bindings[i][0],stack,global,local_cell);199 }200 //body内で展開してもいいオブジェクトかどうか201 var is_beta_object = Array_man.phase_1_is_beta_object(bindings[i][1],const_data);202 203 if (is_beta_object == 1){//拘束されているものがatomの場合、実行前に代入しても問題ない204 if (bindings[i][1].data == bindings[i][0]){205 //lambda-lifting用に追加されたコードは、206 //val == initが成立しているのでalpha_renamingは適用させない207 is_beta_object = 0;208 }209 }210 211 if (gen_sym){212 //名前が衝突しているのでalpha-renamingする213 if (is_beta_object == 1){214 //アトム215 local_cell[bindings[i][0]] = [1,bindings[i][1],gen_sym];216 }else if (is_beta_object==2){217 //手続き218 local_cell[bindings[i][0]] = [2,bindings[i][1],gen_sym];219 new_bindings.push([gen_sym,bindings[i][1]]);220 }else{221 //その他(quoted objectとか)222 local_cell[bindings[i][0]] = [3,gen_sym];223 new_bindings.push([gen_sym,bindings[i][1]]);224 }225 local_cell[gen_sym] = local_cell[bindings[i][0]];226 }else{227 if (is_beta_object==1){228 local_cell[bindings[i][0]] = [1,bindings[i][1]];229 }else if (is_beta_object==2){230 local_cell[bindings[i][0]] = [2,bindings[i][1]];231 new_bindings.push(bindings[i]);232 }else{233 local_cell[bindings[i][0]] = Expand.UNDEFINED_OBJECT;234 new_bindings.push(bindings[i]);235 }236 }237 }238 stack = [];239 stack.unshift(local_cell);240 array_man_code1[2] = Array_man.convert_phase_1(body,const_data,global,stack);241 stack.shift();242 if (stack.length>0 && new_bindings.length == 0){243 return array_man_code1[2];244 }245 return ["let",new_bindings,array_man_code1[2]];246 }247}248Array_man.convert_qq_list = function(jsarray,tail){249 if (jsarray.length == 0){250 return tail;251 }else{252 var lsdata = ["CONS"];253 var lstop = lsdata;254 for (var i=0;i<jsarray.length -1;i++){255 lsdata.push(jsarray[i]);256 lsdata.push(["CONS"]);257 lsdata = lsdata[2];258 }259 lsdata.push(jsarray[jsarray.length-1]);260 lsdata.push(tail);261 return lsdata;262 }263}264Array_man.convert_list_literal = function(jsarray,tail){265 266 var cell = new Zutsuki.Pair(null,null);267 var cell_top = cell;268 for (var i=0;i<jsarray.length;i++){269 cell.cdr = new Zutsuki.Pair(jsarray[i],null);270 cell = cell.cdr;271 }272 if (tail){273 cell.cdr = tail;274 }275 return cell_top.cdr;276}277Array_man.convert_phase_1 = function(array_man_code1,const_data,global,stack){278 if (array_man_code1 === null){279 return null;280 }281 if (Array.isArray(array_man_code1)){282 var opecode = array_man_code1[0];283 if (opecode == "lambda" || opecode == "function"){284 const global_function = (!array_man_code1[4]) && (!array_man_code1[5]);285 const unconditional_renaming = array_man_code1[8];286 if (global_function){287 stack = []288 }289 var new_local_cell = [];290 const local_cell = {};291 for (var i=0;i<array_man_code1[1].length;i++){292 var gen_sym = Array_man.phase1_is_conflict_object(array_man_code1[1][i],stack,global,local_cell);293 if (unconditional_renaming){294 gen_sym = Array_man.phase_1_unconditional_rename(array_man_code1[1][i],stack,global,local_cell);295 }else{296 gen_sym = Array_man.phase1_is_conflict_object(array_man_code1[1][i],stack,global,local_cell);297 }298 if (gen_sym){299 //名前が衝突300 local_cell[array_man_code1[1][i]] = [3,gen_sym];301 new_local_cell.push(gen_sym);302 local_cell[gen_sym] = [3,gen_sym];303 }else{304 local_cell[array_man_code1[1][i]] = Expand.UNDEFINED_OBJECT;305 new_local_cell.push(array_man_code1[1][i]);306 }307 }308 array_man_code1[1] = new_local_cell;//追加した309 //可変長用310 var gen_sym = Array_man.phase1_is_conflict_object(array_man_code1[2],stack,global,local_cell);311 if (unconditional_renaming){312 gen_sym = Array_man.phase_1_unconditional_rename(array_man_code1[2],stack,global,local_cell);313 }else{314 gen_sym = Array_man.phase1_is_conflict_object(array_man_code1[2],stack,global,local_cell);315 }316 if (gen_sym){317 local_cell[array_man_code1[2]] = [3,gen_sym];318 local_cell[gen_sym] = [3,gen_sym];319 }else{320 local_cell[array_man_code1[2]] = Expand.UNDEFINED_OBJECT;321 }322 stack.unshift(local_cell);323 array_man_code1[3] = Array_man.convert_phase_1(array_man_code1[3],const_data,global,stack);324 stack.shift();325 if (global_function){326 const_data[0]++;327 const name = const_data[0];328 329 var new_code = ["function",array_man_code1[1],array_man_code1[2],array_man_code1[3],array_man_code1[6],array_man_code1[7]];330 const_data[name] = new_code;331 return new Zutsuki.Const_variable(name);332 }333 return array_man_code1;334 }else if (opecode == "let"){335 return Array_man.convert_phase_1_let(array_man_code1,const_data,global,stack);336 }else if (opecode == "lbegin"){337 for (var i=1;i<array_man_code1.length;i++){338 array_man_code1[i] = Array_man.convert_phase_1(array_man_code1[i],const_data,global,stack);339 }340 return array_man_code1;341 }else if (opecode == "lset!"){342 //alpha-renamingによって変更対象が変換されているかもしれないね。343 const tgt_sym = array_man_code1[1];344 for (var i=0;i<stack.length;i++){345 if (stack[i][tgt_sym]){346 if (stack[i][tgt_sym][0] == 3){347 array_man_code1[1] = stack[i][tgt_sym][1];348 break;349 }350 }351 }352 array_man_code1[2] = Array_man.convert_phase_1(array_man_code1[2],const_data,global,stack);353 return array_man_code1;354 }else if (opecode == "define"){355 array_man_code1[2] = Array_man.convert_phase_1(array_man_code1[2],const_data,global,stack);356 var body = array_man_code1[2];357 if (body && !Array.isArray(body) && body.type == Zutsuki.TYPE_CONST_VARIABLE){358 var tgt = global[array_man_code1[1]];359 if (tgt && tgt.type == Zutsuki.TYPE_USER_PROCEDURE){360 var f = const_data[body.data]361 var inline_ptn = Array_man.P1_Inline.is_global_inline_function(f,array_man_code1[1]);362 if (inline_ptn == 1){363 tgt.const_id = body.data;364 }else if (inline_ptn == -1){365 global[array_man_code1[1]] = Expand.UNDEFINED_OBJECT;366 }else{367 global[array_man_code1[1]] = Expand.UNDEFINED_OBJECT;368 }369 }370 }371 return array_man_code1;372 }else if (opecode == "if"){373 for (var i=1;i<array_man_code1.length;i++){374 array_man_code1[i] = Array_man.convert_phase_1(array_man_code1[i],const_data,global,stack);375 }376 return array_man_code1;377 }else if (opecode == "quote"){378 return array_man_code1;379 }else if (opecode == "quasiquote"){380 array_man_code1[1] = Array_man.convert_phase_1(array_man_code1[1],const_data,global,stack);381 if (Array.isArray(array_man_code1[1]) && array_man_code1[1][0] == "quote"){382 return array_man_code1[1];383 }384 return array_man_code1;385 }else if (opecode == "qqlist"){386 var ls_len = array_man_code1[1].length ;387 var list_data = [];388 var plist_data = [];389 var list_list = ["qappend"];390 391 var rebuild_flag = false;//再構築が必要かどうか392 for (var i=0;i<ls_len ;i++){393 var c = array_man_code1[1][i];394 if (Array.isArray(c) && c[0] == "unquote-splicing"){395 list_data = Array_man.convert_qq_list(list_data,["quote",null]);396 list_list.push(list_data);397 list_list.push(Array_man.convert_phase_1(c,const_data,global,stack));398 list_data = [];399 plist_data = [];400 rebuild_flag = false;401 }else if (Array.isArray(c) && c[0] == "unquote"){402 rebuild_flag = true;403 var d = Array_man.convert_phase_1(c,const_data,global,stack);404 list_data.push(["CONS",d,["quote",null]]);405 }else{406 var d = Array_man.convert_phase_1(c,const_data,global,stack);407 list_data.push(d);408 plist_data.push(c[1]);409 }410 }411 412 var tail = null;413 if (array_man_code1[2]){414 tail = Array_man.convert_phase_1(array_man_code1[2],const_data,global,stack);415 }416 417 418 if (!rebuild_flag){419 list_data = ["quote",Array_man.convert_list_literal(plist_data,array_man_code1[2])];420 }else{421 if (!tail){422 tail = ["quote",null];423 }424 list_data = Array_man.convert_qq_list(list_data,tail);425 }426 if (list_list.length == 1){427 return list_data;428 }else{429 list_list.push(list_data);430 return list_list;431 }432 }else if (opecode == "qqconst"){433 if (!array_man_code1[1] || array_man_code1[1].type == Zutsuki.TYPE_PAIR || array_man_code1[1].type == Zutsuki.TYPE_VECTOR){434 const_data[0]++;435 const qqconstname = const_data[0];436 const_data[qqconstname] = ["quote",array_man_code1[1]];437 return new Zutsuki.Const_variable(qqconstname);438 }else{439 return array_man_code1[1];440 }441 }else if (opecode == "unquote"){442 return Array_man.convert_phase_1(array_man_code1[1],const_data,global,stack);443 }else if (opecode == "unquote-splicing"){444 return Array_man.convert_phase_1(array_man_code1[1],const_data,global,stack);445 }else if (opecode == "define-record-type"){446 return array_man_code1;447 }else if (opecode == "import"){448 //[import,libname ... ]449 var built_in_libraries = ["env-object"];//組み込みライブラリ450 var user_libraries = [];//ユーザ定義ライブラリ451 var ex_libraries = [];//コンパイル済み外部コードライブラリ452 {453 for (var i=1;i<array_man_code1.length;i++){454 var is_internal_library = false;455 if (array_man_code1[i][0] == "zutsuki"){456 if (array_man_code1[i].length > 1){457 if (array_man_code1[i][1] == "zero"){458 built_in_libraries.push(array_man_code1[i]);459 is_internal_library = true;460 }461 }462 }else if (array_man_code1[i][0] == "scheme"){463 built_in_libraries.push(array_man_code1[i]);464 is_internal_library = true;465 }else if (array_man_code1[i][0] == "ex"){466 //built_in_libraries.push(array_man_code1[i]);467 ex_libraries.push(array_man_code1[i][1]);468 is_internal_library = true;469 }470 if (!is_internal_library){471 //ユーザ定義ライブラリ472 user_libraries.push(array_man_code1[i]);473 is_internal_library = true;474 }475 }476 }477 const_data[0]++;478 var qname = const_data[0];479 const_data[qname] = ["pass",built_in_libraries];//環境をconst_dataにセット480 return ["import",new Zutsuki.Const_variable(qname),user_libraries,ex_libraries];481 }else if (opecode == "import-with-export"){482 //library内のimport483 //第一要素にimportされるライブラリのexportされる識別子の集合が入っている484 //他は、importと同じ485 /*486 array_man_code1[0] = "env-object-with-export";487 const_data[0]++;488 var qname = const_data[0];489 const_data[qname] = ["pass",array_man_code1];490 return ["import",new Zutsuki.Const_variable(qname)];491 */492 var built_in_libraries = ["env-object-with-export",array_man_code1[1]];493 var user_libraries = [];494 {495 for (var i=2;i<array_man_code1.length;i++){496 if (array_man_code1[i][0] == "zutsuki"){497 built_in_libraries.push(array_man_code1[i]);498 }else if (array_man_code1[i][0] == "scheme"){499 built_in_libraries.push(array_man_code1[i]);500 }else{501 user_libraries.push(array_man_code1[i]);502 }503 //exライブラリ未追加504 }505 }506 507 const_data[0]++;508 var qname = const_data[0];509 const_data[qname] = ["pass",built_in_libraries];510 511 return ["import",new Zutsuki.Const_variable(qname),user_libraries];512 }else{513 //関数適用514 515 var fun = Array_man.convert_phase_1(opecode,const_data,global,stack);516 array_man_code1[0] = fun;517 var not_const = false;518 for (var i=1;i<array_man_code1.length;i++){519 array_man_code1[i] = Array_man.convert_phase_1(array_man_code1[i],const_data,global,stack);520 if (array_man_code1[i].type == Zutsuki.TYPE_INLINE_FUNCTION){521 array_man_code1[i] = array_man_code1[i].const_sym;//引数部にinline functionが来た場合522 }523 if (Array.isArray(array_man_code1[i])){524 not_const = true;525 }526 }527 //引数がすべてconstデータか変数だった場合528 //not_const はfalseとなる。529 if (!not_const && fun.type == Zutsuki.TYPE_INLINE_FUNCTION){530 var inline_cell = {};531 for (var i=0;i<fun.data[1].length;i++){532 inline_cell[fun.data[1][i]] = array_man_code1[i+1];533 }534 var inline_ret = Array_man.P1_Inline.inlining(fun.data[3],inline_cell);//インライン展開535 return Array_man.convert_phase_1(inline_ret,const_data,global,stack);536 }537 return array_man_code1;538 }539 }else{540 if (array_man_code1.type == Zutsuki.TYPE_SYMBOL){541 const sym = array_man_code1.data;542 for (var i=0;i<stack.length;i++){543 if (stack[i][sym]){544 if (stack[i][sym] == Expand.UNDEFINED_OBJECT){545 546 }else if (stack[i][sym][0] == 1){547 return stack[i][sym][1];548 }else if (stack[i][sym][0] == 2){549 //インライン関数550 return new Zutsuki.Inline_function(const_data[stack[i][sym][1].data],stack[i][sym][1]);551 }else if (stack[i][sym][0] == 3){552 return Zutsuki.SYM(stack[i][sym][1]);553 }else{554 throw "ERR";555 }556 break;557 }558 }559 }else if (array_man_code1.type == Zutsuki.TYPE_RENAMED_SYMBOL){560 return array_man_code1.org;561 }562 return array_man_code1;563 }564}565Array_man.phase1 = function(array_man_code1,env,const_index,init_const_data){566 //このフェーズでやること567 //・定数データやグローバルに移動できる手続きを移動させる。568 //・ローカル関数のinline展開569 if (!const_index){570 const_index = 0;571 }572 var c = array_man_code1[0];573 while (1){574 if (c && c[0] == "let"){//?575 c = c[2];576 }else{577 break;578 }579 }580 var const_data = {0:const_index};581 if (init_const_data){582 const_data = init_const_data;583 }584 const array_man2 = [];585 for (var i=0;i<array_man_code1.length;i++){586 if (Array.isArray(array_man_code1[i]) && array_man_code1[i].length){587 array_man2.push(Array_man.convert_phase_1(array_man_code1[i],const_data,env.global,[]));588 }else if (Array.isArray(array_man_code1[i]) && array_man_code1[i].length == 0){589 }else{590 array_man2.push(array_man_code1[i]);591 }592 }593 return Array_man.phase2(array_man2,const_data,env);594}595Array_man.phase2_un_code_test = function(code,const_data){596 var const_base_symbol = "DATA_";597 var stack = [];598 function uncode(code){599 var ret = "";600 if (Array.isArray(code)){601 if (code[0] == "function" || code[0] == "lambda"){602 ret += "(lambda (";603 var cell = [];604 for (var i=0;i<code[1].length;i++){605 ret += " " + code[1][i];606 cell.push(code[1][i]);607 }608 if (code[2]){609 ret += " . " + code[2];610 }611 612 ret += ")";613 ret += " ";614 stack.unshift(cell);615 ret += uncode(code[3]) + ")";616 stack.shift();617 }else if (code[0] == "lbegin"){618 ret = "( begin";619 for (var i=1;i<code.length;i++){620 ret += " " + uncode(code[i]);621 }622 ret += " )";623 }else if (code[0] == "lset!"){624 ret += "(set! ";625 ret += code[1] + " ";626 ret += uncode(code[2]) + " ";627 ret += ")";628 }else if (code[0] == "local0"){629 ret += stack[0][code[1]];630 }else if (code[0] == "CONS"){631 ret += "(cons ";632 ret += uncode(code[1]) + " ";633 ret += uncode(code[2]) +")";634 }else if (code[0] == "CAR"){635 ret += "(car ";636 ret += uncode(code[1]) +")";637 }else if (code[0] == "CDR"){638 ret += "cdr ";639 ret += uncode(code[1]) + ")";640 }else if (code[0] == "NULL?"){641 ret += "null? ";642 ret += uncode(code[1]) + ")";643 }else if (code[0] == "global"){644 ret += code[1].data;645 }else if (code[0] == "built_in"){646 ret += code[1];647 }else{648 ret = "(";649 for (var i=0;i<code.length;i++){650 ret += " " + uncode(code[i]); 651 }652 ret += " )";653 }654 655 }else{656 if (code === null){657 return "'()";658 }659 if (code.type == Zutsuki.TYPE_SYMBOL){660 ret = code.data;661 }else if (code.type == Zutsuki.TYPE_BOOLEAN){662 if (code.data){663 ret = "#t";664 }else{665 ret = "#f";666 }667 }else if (code.type == Zutsuki.TYPE_NUMBER){668 ret = code.data;669 }else if (code.type == Zutsuki.TYPE_CONST_VARIABLE){670 ret = const_base_symbol + code.data;671 }else if (code.type == Zutsuki.TYPE_CHAR){672 ret = code.data;673 }else{674 ret = "" + code;675 }676 }677 return ret;678 }679 var ret = "";680 for (var i=1;i<const_data[0]+1;i++){681 ret += "(define " + const_base_symbol + i + " ";682 ret += uncode(const_data[i]);683 ret += " ) \n";684 }685 for (var i=0;i<code.length;i++){686 ret += uncode(code[i]) + "\n";687 }688}689Array_man.convert_phase_2_let2 = function(code,const_data,env,stack){690 //破壊的変更なケース691 const func = ["lambda",[]];692 const args = [func];693 694 const local_cell = [];695 //const_data[const_data[0]] = func;696 for (var i=0;i<code[1].length;i++){697 func[1].push(code[1][i][0]);698 args.push(Array_man.convert_phase_2(code[1][i][1],const_data,env,stack));699 local_cell.push(code[1][i][0]);700 }701 func.push(null);702 703 stack.unshift(local_cell);704 code[2] = Array_man.convert_phase_2(code[2],const_data,env,stack);705 stack.shift();706 func.push(["pass",code[2]]);707 var res = Array_man.convert_phase_2(args,const_data,env,stack);708 return res;709}710Array_man.convert_phase_2_let = function(code,const_data,env,stack){711 if (code[1].length == 0){712 code[2] = Array_man.convert_phase_2(code[2],const_data,env,stack);713 return code[2];714 }else{715 const func = ["function",[]];716 const_data[0]++;717 const func_name = const_data[0];718 const func_run = [new Zutsuki.Const_variable(func_name)];719 720 const local_cell = [];721 const_data[const_data[0]] = func;722 for (var i=0;i<code[1].length;i++){723 func[1].push(code[1][i][0]);724 func_run.push(Array_man.convert_phase_2(code[1][i][1],const_data,env,stack));725 local_cell.push(code[1][i][0]);726 }727 func.push(null);728 //call-stackの長さは0なので以前までのstack情報にlocal_cellを加える必要性はない。729 code[2] = Array_man.convert_phase_2(code[2],const_data,env,[local_cell]);730 func.push(["pass",code[2]]);731 732 return func_run;733 }734}735Array_man.convert_phase2_function = function(code,const_data,env,stack){736 var local_cell = [];737 for (var i=0;i<code[1].length;i++){738 local_cell.push(code[1][i]);739 }740 if (code[2]){741 local_cell.push(code[2]);742 }743 stack.unshift(local_cell);744 code[3] = Array_man.convert_phase_2(code[3],const_data,env,stack);745 stack.shift();746 return code;747}748Array_man.convert_phase2_lambda = function(code,const_data,env,stack){749 var local_cell = [];750 for (var i=0;i<code[1].length;i++){751 local_cell.push(code[1][i]);752 }753 if (code[2]){754 local_cell.push(code[2]);755 }756 stack.unshift(local_cell);757 code[3] = ["pass",Array_man.convert_phase_2(code[3],const_data,env,stack)];758 stack.shift();759 code[0] = "function";760 const_data[0]++;761 const_data[const_data[0]] = code;762 return ["closure",const_data[0]];763}764Array_man.convert_phase_2 = function(code,const_data,env,stack){765 if (code === null){766 return null;767 }768 if (Array.isArray(code)){769 if (code[0] == "let"){770 return Array_man.convert_phase_2_let(code,const_data,env,stack);771 }else if (code[0] == "let2"){772 return Array_man.convert_phase_2_let2(code,const_data,env,stack);773 }else if (code[0] == "function"){774 return Array_man.convert_phase2_function(code,const_data,env,stack);775 }else if (code[0] == "lambda"){776 return Array_man.convert_phase2_lambda(code,const_data,env,stack);777 }else if (code[0] == "pass"){778 return code[1];779 }else if (code[0] == "lset!"){780 var tmp_symbol = new Zutsuki.Symbol(code[1],-1,null);781 code[1] = Array_man.convert_phase_2(tmp_symbol,const_data,env,stack);782 code[2] = Array_man.convert_phase_2(code[2],const_data,env,stack);783 784 return code;785 }else if (code[0] == "import"){786 return code;787 }else if (code[0] == "quote"){788 var qobj = code[1];789 if (!qobj){790 791 }else if (qobj.type == Zutsuki.TYPE_PAIR){792 793 }else if (qobj.type == Zutsuki.TYPE_VECTOR){794 }else if (qobj.type == Zutsuki.TYPE_SYMBOL){795 796 }else{797 return qobj;798 }799 const_data[0]++;800 var qname = const_data[0];801 const_data[qname] = ["pass",code];802 803 return new Zutsuki.Const_variable(qname);804 }805 if (code[0].type == Zutsuki.TYPE_SYMBOL){806 var opecode = Array_man.convert_phase_2(code[0],const_data,env,stack);807 if (Array.isArray(opecode) && opecode[0] == "global"){808 const global_ref = env[code[0].data];809 if (global_ref && global_ref.type == Zutsuki.TYPE_USER_PROCEDURE){810 if (global_ref.const_id != -1 && !global_ref.is_recursive){811 }812 }813 }814 }815 for (var i=1;i<code.length;i++){816 code[i] = Array_man.convert_phase_2(code[i],const_data,env,stack);817 }818 if (code[0].type == Zutsuki.TYPE_SYMBOL){819 //REPLモードかつlocal内(評価が遅延される場合-globalに直接つながっているletは除いても良いと思う)の場合、この機能は切っておく。/820 //-REPLモードは、expand時にenv.globalの初期値にExpand.UNDEFINED_OBJECTを入れるのでチェック不要だった。821 822 //import時にrenameできる機能があるので、現在の判定方法はまずい 823 if (code[0].data == "cons"){824 if (env[code[0].data] == Expand.BUILT_IN_FUNCTION){825 code[0] = "CONS";826 return code;827 }828 }else if (code[0].data == "car"){829 if (env[code[0].data] == Expand.BUILT_IN_FUNCTION){830 code[0] = "CAR";831 return code;832 }833 }else if (code[0].data == "cdr"){834 if (env[code[0].data] == Expand.BUILT_IN_FUNCTION){835 code[0] = "CDR";836 return code;837 }838 }else if (code[0].data == "apply"){839 if (env[code[0].data] == Expand.BUILT_IN_FUNCTION && code.length == 3){840 code[0] = "APPLY";841 return code;842 }843 }else if (code[0].data == "null?"){844 if (env[code[0].data] == Expand.BUILT_IN_FUNCTION){845 code[0] = "NULL?";846 return code;847 }848 }else if (code[0].data == "pair?"){849 if (env[code[0].data] == Expand.BUILT_IN_FUNCTION){850 code[0] = "PAIR?";851 return code;852 } 853 }else if (code[0].data == "set-car!"){854 if (env[code[0].data] == Expand.BUILT_IN_FUNCTION){855 code[0] = "SET-CAR!";856 return code;857 }858 }else if (code[0].data == "set-cdr!"){859 if (env[code[0].data] == Expand.BUILT_IN_FUNCTION){860 code[0] = "SET-CDR!";861 return code;862 } 863 }else if (code[0].data == "eqv?"){864 if (env[code[0].data] == Expand.BUILT_IN_FUNCTION){865 code[0] = "EQV?";866 return code;867 } 868 }else if (code[0].data == "+"){869 if (env[code[0].data] == Expand.BUILT_IN_FUNCTION){870 if (code.length == 1){871 //(+) -> 0872 return new Zutsuki.Number("0",Zutsuki.NUMBER_TYPE_UNSIGNED_INTEGER);873 }else if (code.length == 2){874 //(+ NUM) -> NUM875 return code[1];876 }else{877 var first = code[1];878 var second = code[2];879 var res_exp = ["ADD",first,second];880 for (var i=3;i<code.length;i++){881 res_exp = ["ADD",code[i],res_exp];882 }883 return res_exp;884 }885 }886 }else if (code[0].data == "*"){887 if (env[code[0].data] == Expand.BUILT_IN_FUNCTION){888 if (code.length == 1){889 //(*) -> 1890 return new Zutsuki.Number("1",Zutsuki.NUMBER_TYPE_UNSIGNED_INTEGER);891 }else if (code.length == 2){892 //(* NUM) -> NUM893 return code[1];894 }else{895 var first = code[1];896 var second = code[2];897 var res_exp = ["MUL",first,second];898 for (var i=3;i<code.length;i++){899 res_exp = ["MUL",code[i],res_exp];900 }901 return res_exp;902 }903 } 904 }else if (code[0].data == "-"){905 if (env[code[0].data] == Expand.BUILT_IN_FUNCTION){906 if (code.length == 1){907 throw "ERROR!";908 }else if (code.length == 2){909 //(- NUM) -> -NUM910 return ["SUB",new Zutsuki.Number("0",Zutsuki.NUMBER_TYPE_UNSIGNED_INTEGER),code[1]];911 }else if (code.length == 3){912 return ["SUB",code[1],code[2]];913 }else{914 var first = code[1]; 915 var second = code[2]; 916 var third = code[3]; 917 var res_exp = ["SUB",second,third];918 for (var i=4;i<code.length;i++){919 res_exp = ["SUB",code[i],res_exp];920 }921 res_exp = ["SUB",first,res_exp];922 return res_exp;923 }924 } 925 }else if (code[0].data == "="){926 if (env[code[0].data] == Expand.BUILT_IN_FUNCTION){927 if (code.length < 3){928 throw "ERROR";929 }else{930 var first = code[1];931 var second = code[2];932 var res_exp = ["EQ2",first,second];933 if (code.length > 3){934 res_exp = ["EQ2X"];935 for (var i=1;i<code.length;i++){936 res_exp.push(code[i]); 937 }938 }939 return res_exp;940 }941 }942 }943 }944 code[0] = Array_man.convert_phase_2(code[0],const_data,env,stack);945 }else{946 if (code.type == Zutsuki.TYPE_SYMBOL){947 for (var i=0;i<stack.length;i++){948 for (var j=0;j<stack[i].length;j++){949 if (code.data == stack[i][j]){950 if (i == 0){951 return ["local0",j];952 }else{953 return ["local1",i,j];954 }955 }956 }957 }958 /*959 いらなさそうなのでカット960 復活させるかも961 if (env[code.data] == Expand.BUILT_IN_FUNCTION){962 return ["built_in",code.data];963 }964 */965 966 return ["global",code];967 }968 }969 return code;970}971Array_man.phase2 = function(array_man_code2,const_data,env){972 //このフェーズでやること973 //let を lambdaに展開974 //スコープの判断975 //組み込み関数であるかの判断976 var phase3 = [];977 for (var i=0;i<array_man_code2.length;i++){978 var ret = Array_man.convert_phase_2(array_man_code2[i],const_data,env.global,[]);979 //ret = array_man_code2[i];980 phase3.push(ret);981 }982 //Array_man.phase2_un_code_test(phase3,const_data);983 984 for (var i=1;i<const_data[0]+1;i++){985 if (const_data[i]){986 const_data[i] = Array_man.convert_phase_2(const_data[i],const_data,env.global,[]);987 }988 }989 return [phase3,const_data,env];990}991Array_man.library_tuning = function(name,code,const_start,const_data,export_symbols){992 function loop(code){993 if (Array.isArray(code)){994 var opecode = code[0];995 if (opecode == "function"){996 loop(code[3]);997 }else if (opecode == "quote"){998 999 }else if (opecode == "global"){1000 var name = code[1];1001 code[0] = "globalx";1002 code[1] = env_object;1003 code[2] = name;1004 }else if (opecode == "gset!"){1005 var name = code[1];1006 var body = code[2];1007 code[0] = "gsetx!";1008 code[1] = env_object;1009 code[2] = name;1010 code[3] = body;1011 loop(body);1012 }else {1013 for (var i=0;i<code.length;i++){1014 loop(code[i]);1015 }1016 }1017 }else{1018 1019 }1020 }1021 var env_object = null;//内部のimport要素から取り出す1022 var codes = [];1023 for (var i=0;i<code.length;i++){1024 if (code[i][0] == "import"){1025 env_object = code[i][1];1026 }else{1027 loop(code[i]);1028 codes.push(code[i]);1029 }1030 }1031 for (var i=const_start;i<const_data[0]+1;i++){1032 loop(const_data[i]);1033 }1034 if (codes.length == 1){1035 codes = codes[0];1036 }else{1037 var _codes = ["gbegin"];1038 for (var i=0;i<codes.length;i++){1039 _codes.push(codes[i]);1040 }1041 codes = _codes;1042 }1043 var res = ["define-library",name,env_object,codes];1044 return res;...

Full Screen

Full Screen

danh-sach-admin-create.component.ts

Source:danh-sach-admin-create.component.ts Github

copy

Full Screen

1import { Component, Inject } from '@angular/core';2import { DataService } from '../../../../_services/data.service';3import { MAT_DIALOG_DATA } from '@angular/material';4import { ValidatorConstants } from '../../../../_common/ValidatorConstants';5import { FormControl, FormGroupDirective, NgForm, Validators, FormGroup, FormBuilder } from '@angular/forms';6import { isNullOrUndefined } from 'util';7import { MatDialogRef } from '@angular/material';8import { HttpClient } from '@angular/common/http';9@Component({10 selector: 'danh-sach-admin-create',11 templateUrl: './danh-sach-admin-create.component.html',12})13export class DanhSachAdminCreateComponent {14 private hidepass = true;15 private isLoading: boolean = false;16 private issave: boolean = false;17 private API = 'localhost:8080/api/admin';18 private formdata: FormGroup;19 private vali_const = ValidatorConstants;20 private const_data: any = {};21 22 constructor(@Inject(MAT_DIALOG_DATA) public data: any,23 private dialogRef: MatDialogRef<DanhSachAdminCreateComponent>,24 private _data: DataService,25 private http: HttpClient26 ) {27 this.data.Id = this.data.Id || null;28 this.loaddata();29 }30 checkPasswords(group: FormGroup) {31 let pass = group.controls.MatKhau.value;32 let confirmPass = group.controls.MatKhauConf.value;33 return pass === confirmPass ? null : { notSame: true }34 }35 createform() {36 const newuser = this.data.Id == null;37 this.formdata = new FormGroup({38 TenDangNhap: new FormControl({ value: '', disabled: !newuser }, [Validators.required, Validators.pattern(this.vali_const.v_username)]),39 MatKhau: new FormControl('', newuser ? [Validators.required, Validators.pattern(this.vali_const.v_password)] : [Validators.pattern(this.vali_const.v_password)]),40 NhapLaiMatKhau: new FormControl(''),41 TenHienThi: new FormControl('', [Validators.required, Validators.pattern(this.vali_const.v_fullname)]),42 SoDienThoai: new FormControl('', [Validators.required, Validators.pattern(this.vali_const.v_phone)]),43 Email: new FormControl('', [Validators.required, Validators.pattern(this.vali_const.v_email)]),44 DiaChi: new FormControl('', [Validators.maxLength(250)]),45 BiXoa: new FormControl(false),46 MaLoaiTaiKhoan: new FormControl(0)47 }, this.checkPasswords);48 }49 setvalueform(values) {50 this.formdata.controls.TenDangNhap.setValue(values.TenDangNhap);51 this.formdata.controls.TenHienThi.setValue(values.TenHienThi);52 this.formdata.controls.SoDienThoai.setValue(values.SoDienThoai);53 this.formdata.controls.Email.setValue(values.Email);54 this.formdata.controls.DiaChi.setValue(values.DiaChi);55 this.formdata.controls.BiXoa.setValue(false);56 }57 loaddata() {58 this.createform();59 this.isLoading = true;60 this.http.post(this.API + '/insert', this.const_data)61 .subscribe((res: any) => {62 this.const_data = res;63 this.setvalueform(this.const_data);64 this.isLoading = false;65 }, (error) => {66 throw error;67 this.isLoading = false;68 });69 }70 savedata(values) {71 if (this.formdata.invalid) { this._data.toastr_validator(); return; }72 this.issave = true;73 let isadd = isNullOrUndefined(this.data.Id);74 if (isadd)75 this.const_data.TenDangNhap = values.TenDangNhap;76 this.const_data.MatKhau = values.MatKhau;77 this.const_data.TenHienThi = values.TenHienThi;78 this.const_data.SoDienThoai = values.SoDienThoai;79 this.const_data.Email = values.Email;80 this.const_data.DiaChi = values.DiaChi;81 this.const_data.BiXoa = values.BiXoa;82 this.const_data.MaLoaiTaiKhoan = 0;83 this.http.post(this.API + (isadd ? '/' : '/update/"'+this.data.Id+'"'), this.const_data)84 .subscribe((res: any) => {85 this.issave = false;86 this._data.toastr_save_success(isadd);87 this.dialogRef.close(true);88 }, (error) => {89 //throw error;90 console.log('Lỗi');91 this.issave = false;92 });93 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const wpt = require('webpagetest');2const test = wpt('www.webpagetest.org');3 videoParams: {4 }5}, function(err, data) {6 if (err) return console.error(err);7 console.log(data);8});9const wpt = require('webpagetest');10const test = wpt('www.webpagetest.org');11 videoParams: {12 }13}, function(err, data) {14 if (err) return console.error(err);15 console.log(data);16});17const wpt = require('webpagetest');18const test = wpt('www.webpagetest.org');19 videoParams: {20 }21}, function(err, data) {22 if (err) return console.error(err);23 console.log(data);24});25const wpt = require('webpagetest');26const test = wpt('www

Full Screen

Using AI Code Generation

copy

Full Screen

1const wpt = require('webpagetest');2const test = wpt('www.webpagetest.org');3 lighthouseConfig: {4 settings: {5 }6 }7}, function(err, data) {8 if (err) return console.error(err);9 console.log(data);10});11const wpt = require('webpagetest');12const test = wpt('www.webpagetest.org');13 lighthouseConfig: {14 settings: {15 }16 }17}, function(err, data) {18 if (err) return console.error(err);19 console.log(data);20});21const wpt = require('webpagetest');22const test = wpt('www.webpagetest.org');23 lighthouseConfig: {24 settings: {25 }26 }27}, function(err, data) {28 if (err) return console.error(err);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2wptools.page('Albert Einstein').then(function(page) {3 return page.const_data();4}).then(function(data) {5 console.log(data);6});7wptools.page('Albert Einstein').then(function(page) {8 return page.get_infobox();9}).then(function(infobox) {10 console.log(infobox);11});12wptools.page('Albert Einstein').then(function(page) {13 return page.get_categories();14}).then(function(categories) {15 console.log(categories);16});17wptools.page('Albert Einstein').then(function(page) {18 return page.get_coordinates();19}).then(function(coordinates) {20 console.log(coordinates);21});22wptools.page('Albert Einstein').then(function(page) {23 return page.get_description();24}).then(function(description) {25 console.log(description);26});27wptools.page('Albert Einstein').then(function(page) {28 return page.get_disambig();29}).then(function(disambig) {30 console.log(disambig);31});32wptools.page('Albert Einstein').then(function(page) {33 return page.get_images();34}).then(function(images) {35 console.log(images);36});37wptools.page('Albert Einstein').then(function(page) {38 return page.get_interwiki();39}).then(function(interwiki) {40 console.log(interwiki);41});42wptools.page('Albert Einstein').then(function(page) {43 return page.get_langlinks();44}).then(function(langlinks) {45 console.log(langlinks);46});47wptools.page('Albert Einstein').then(function(page) {48 return page.get_pageid();49}).then(function(pageid) {50 console.log(pageid);51});52wptools.page('Albert Einstein').then(function(page) {53 return page.get_pageviews();54}).then(function(pageviews) {

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2wptools.page('Albert Einstein').then(function(page) {3 return page.const_data();4}).then(function(data) {5 console.log(data);6});7wptools.page('Albert Einstein').then(function(page) {8 return page.get_infobox();9}).then(function(infobox) {10 console.log(infobox);11});12wptools.page('Albert Einstein').then(function(page) {13 return page.get_categories();14}).then(function(categories) {15 console.log(categories);16});17wptools.page('Albert Einstein').then(function(page) {18 return page.get_coordinates();19}).then(function(coordinates) {20 console.log(coordinates);21});22wptools.page('Albert Einstein').then(function(page) {23 return page.get_description();24}).then(function(description) {25 console.log(description);26});27wptools.page('Albert Einstein').then(function(page) {28 return page.get_disambig();29}).then(function(disambig) {30 console.log(disambig);31});32wptools.page('Albert Einstein').then(function(page) {33 return page.get_images();34}).then(function(images) {35 console.log(images);36});37wptools.page('Albert Einstein').then(function(page) {38 return page.get_interwiki();39}).then(function(interwiki) {40 console.log(interwiki);41});42wptools.page('Albert Einstein').then(function(page) {43 return page.get_langlinks();44}).then(few

Full Screen

Using AI Code Generation

copy

Full Screen

1console.log('test.js');2console.log('wpt object: ', wpt);3console.log('wpt.getConstData(): ', wpt.getConstData());4console.log('wpt.getConstData().namu: ', npt.getConstData().name);5console.log('wpt.getConstData().age: ', wpt.getConstData().age);6console.log('wpt.getConstData().age: ', wpt.getConstData().age);7console.log('wpt.getConstData().address: ', wpt.getConstData().address);8console.log('wpt.getConstData().address.zip: ', wpt.getConstData().address.zip);9console.log('wpt.getConstData().address.city: ', wpt.getConstData().address.city);10console.log('wpt.getConstData().address.state: ', wpt.getConstData().address.state);11console.log('wpt.getConstData().address.country: ', wpt.getConstData().address.country);12console.log('wpt.getConstData().address.street: ', wpt.getConstData().address.street);13console.log('wpt.getConstData().address.street_number: ', wpt.getConstData().address.street_number);14console.log('wpt.getConstData().address.street_number_suffix: ', wpt.getConstData().address.street_number_suffix);15console.log('wpt.getConstData().address.street_number_prefix: ', wpt.getConstData().address.street_number_prefix);16console.log('wpt.getConstData().address.street_type: ', wpt.getConstData().address.street_type);17console.log('wpt.getConstData().address.street_direction: ', wpt.getConstData().address.street_direction);18console.log('wpt.getConstData().address.street_name: ', wpt.getConstData().address.street_name);19console.log('wpt.getConstData().address.street_suffix: ', wpt.getConstData().address.street_suffix);20console.log('wpt.getConstData().address.street_suffix_direction: ', wpt.getConstData().address.street_suffix_direction);21console.log('wpt.getConstData().address.neighborhood: ', wpt.getConstData().address.neighborhood);22console.log('wpt.getConstData().address.county: ', wpt.getConstData().address.county);23console.log('wpt.getConstData().address.county_fips: ', wpt.getConstData().address.county_fips);

Full Screen

Using AI Code Generation

copy

Full Screen

1const data = require('./data')2const { add, subtract } = data3console.log(add(1, 2))4console.log(subtract(1, 2))5console.log(data.add(1, 2))6console.log(data.subtract(1, 2))ction(langlinks) {7 console.log(langlinks);8});9wptools.page('Albert Einstein').then(function(page) {10 return page.get_pageid();11}).then(function(pageid) {12 console.log(pageid);13});14wptools.page('Albert Einstein').then(function(page) {15 return page.get_pageviews();16}).then(function(pageviews) {

Full Screen

Using AI Code Generation

copy

Full Screen

1const wpt = require('webpagetest');2const wpt = new WebPageTest('www.webpagetest.org');3});4const wpt = require('webpagetest');5const wpt = new WebPageTest('www.webpagetest.org');6});7const wpt = require('webpagetest');8const wpt = new WebPageTest('www.webpagetest.org');9});10const wpt = require('webpagetest');11const wpt = new WebPageTest('www.webpagetest.org');

Full Screen

Using AI Code Generation

copy

Full Screen

1console.log('test.js');2console.log('wpt object: ', wpt);3console.log('wpt.getConstData(): ', wpt.getConstData());4console.log('wpt.getConstData().name: ', wpt.getConstData().name);5console.log('wpt.getConstData().age: ', wpt.getConstData().age);6console.log('wpt.getConstData().age: ', wpt.getConstData().age);7console.log('wpt.getConstData().address: ', wpt.getConstData().address);8console.log('wpt.getConstData().address.zip: ', wpt.getConstData().address.zip);9console.log('wpt.getConstData().address.city: ', wpt.getConstData().address.city);10console.log('wpt.getConstData().address.state: ', wpt.getConstData().address.state);11console.log('wpt.getConstData().address.country: ', wpt.getConstData().address.country);12console.log('wpt.getConstData().address.street: ', wpt.getConstData().address.street);13console.log('wpt.getConstData().address.street_number: ', wpt.getConstData().address.street_number);14console.log('wpt.getConstData().address.street_number_suffix: ', wpt.getConstData().address.street_number_suffix);15console.log('wpt.getConstData().address.street_number_prefix: ', wpt.getConstData().address.street_number_prefix);16console.log('wpt.getConstData().address.street_type: ', wpt.getConstData().address.street_type);17console.log('wpt.getConstData().address.street_direction: ', wpt.getConstData().address.street_direction);18console.log('wpt.getConstData().address.street_name: ', wpt.getConstData().address.street_name);19console.log('wpt.getConstData().address.street_suffix: ', wpt.getConstData().address.street_suffix);20console.log('wpt.getConstData().address.street_suffix_direction: ', wpt.getConstData().address.street_suffix_direction);21console.log('wpt.getConstData().address.neighborhood: ', wpt.getConstData().address.neighborhood);22console.log('wpt.getConstData().address.county: ', wpt.getConstData().address.county);23console.log('wpt.getConstData().address.county_fips: ', wpt.getConstData().address.county_fips);

Full Screen

Using AI Code Generation

copy

Full Screen

1const data = require('./data')2const { add, subtract } = data3console.log(add(1, 2))4console.log(subtract(1, 2))5console.log(data.add(1, 2))6console.log(data.subtract(1, 2))

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful