MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix arrow function parsing

+25 -19
+2 -1
examples/spec/run.js
··· 29 29 const name = path.basename(file, '.js'); 30 30 31 31 try { 32 - const output = $`./build/ant ${filePath}`.text(); 32 + const result = $`./build/ant ${filePath}`; 33 + const output = result.text(); 33 34 console.log(output); 34 35 35 36 const passedMatch = output.match(/Passed:\s*(\d+)/);
+1 -1
meson.build
··· 96 96 build_date = run_command('date', '+%Y-%m-%d', check: true).stdout().strip() 97 97 98 98 version_conf = configuration_data() 99 - version_conf.set('ANT_VERSION', '0.3.2.37') 99 + version_conf.set('ANT_VERSION', '0.3.2.38') 100 100 version_conf.set('ANT_GIT_HASH', git_hash) 101 101 version_conf.set('ANT_BUILD_DATE', build_date) 102 102
+22 -17
src/ant.c
··· 437 437 [TOK_UPLUS] = 1, [TOK_UMINUS] = 1, [TOK_VOID] = 1, 438 438 }; 439 439 440 + static const uint8_t body_end_tok[TOK_MAX] = { 441 + [TOK_RPAREN] = 1, [TOK_RBRACE] = 1, [TOK_RBRACKET] = 1, 442 + [TOK_SEMICOLON] = 1, [TOK_COMMA] = 1, [TOK_EOF] = 1, 443 + }; 444 + 440 445 enum { 441 446 T_OBJ, T_PROP, T_STR, T_UNDEF, T_NULL, T_NUM, T_BOOL, T_FUNC, 442 447 T_CODEREF, T_CFUNC, T_ERR, T_ARR, T_PROMISE, T_TYPEDARRAY, ··· 651 656 return vtype(v) == T_UNDEF; 652 657 } 653 658 654 - static uint8_t unhex(uint8_t c) { 655 - return (c >= '0' && c <= '9') ? (uint8_t) (c - '0') : (c >= 'a' && c <= 'f') ? (uint8_t) (c - 'W') : (c >= 'A' && c <= 'F') ? (uint8_t) (c - '7') : 0; 659 + static inline uint8_t unhex(uint8_t c) { 660 + return (c & 0xF) + (c >> 6) * 9; 656 661 } 657 662 658 - static bool is_unary(uint8_t tok) { 663 + static inline bool is_unary(uint8_t tok) { 659 664 return unary_table[tok]; 660 665 } 661 666 662 - static bool is_assign(uint8_t tok) { 663 - return tok >= TOK_ASSIGN && tok <= TOK_NULLISH_ASSIGN; 667 + static inline int is_body_end_tok(int tok) { 668 + return body_end_tok[tok]; 664 669 } 665 670 666 - static bool is_identifier_like(uint8_t tok) { 667 - return tok >= TOK_IDENTIFIER && tok < TOK_IDENT_LIKE_END; 671 + static inline bool is_assign(uint8_t tok) { 672 + return tok >= TOK_ASSIGN && tok <= TOK_NULLISH_ASSIGN; 668 673 } 669 674 670 - static inline int is_body_end_tok(int tok) { 671 - return tok == TOK_RPAREN || tok == TOK_RBRACE || tok == TOK_SEMICOLON || tok == TOK_COMMA || tok == TOK_EOF; 675 + static inline bool is_identifier_like(uint8_t tok) { 676 + return tok >= TOK_IDENTIFIER && tok < TOK_IDENT_LIKE_END; 672 677 } 673 678 674 - static bool is_keyword_propname(uint8_t tok) { 679 + static inline bool is_keyword_propname(uint8_t tok) { 675 680 return (tok >= TOK_ASYNC && tok <= TOK_GLOBAL_THIS) || tok == TOK_TYPEOF; 676 681 } 677 682 678 - static inline bool is_unboxed_obj(struct js *js, jsval_t val, jsval_t expected_proto) { 679 - if (vtype(val) != T_OBJ) return false; 680 - if (vtype(get_slot(js, val, SLOT_PRIMITIVE)) != T_UNDEF) return false; 681 - jsval_t proto = get_slot(js, val, SLOT_PROTO); 682 - return vdata(proto) == vdata(expected_proto); 683 - } 684 - 685 683 static bool is_valid_arrow_param_tok(uint8_t tok) { 686 684 static const uint64_t bits[4] = { 687 685 0x0004000000000FCCull, ··· 690 688 0x0000000000000000ull 691 689 }; 692 690 return (bits[tok >> 6] >> (tok & 63)) & 1; 691 + } 692 + 693 + static inline bool is_unboxed_obj(struct js *js, jsval_t val, jsval_t expected_proto) { 694 + if (vtype(val) != T_OBJ) return false; 695 + if (vtype(get_slot(js, val, SLOT_PRIMITIVE)) != T_UNDEF) return false; 696 + jsval_t proto = get_slot(js, val, SLOT_PROTO); 697 + return vdata(proto) == vdata(expected_proto); 693 698 } 694 699 695 700 static uint32_t js_to_uint32(double d) {