| ... | ... | @@ -1348,7 +1348,12 @@ Happy writing! |
| 1348 | 1348 | yield { src: "false", tag: Tag.identifier }; |
| 1349 | 1349 | return; |
| 1350 | 1350 | } |
| 1351 | | |
| 1351 | |
| 1352 | case "unreachable": { |
| 1353 | yield { src: "unreachable", tag: Tag.identifier }; |
| 1354 | return; |
| 1355 | } |
| 1356 | |
| 1352 | 1357 | case "&": { |
| 1353 | 1358 | yield { src: "&", tag: Tag.ampersand }; |
| 1354 | 1359 | yield* ex(zigAnalysis.exprs[expr["&"]], opts); |
| ... | ... | @@ -1490,6 +1495,59 @@ Happy writing! |
| 1490 | 1495 | yield Tok.r_bracket; |
| 1491 | 1496 | return; |
| 1492 | 1497 | } |
| 1498 | |
| 1499 | case "sliceIndex": { |
| 1500 | const slice = zigAnalysis.exprs[expr.sliceIndex]; |
| 1501 | yield* ex(slice, opts); |
| 1502 | return; |
| 1503 | } |
| 1504 | |
| 1505 | case "slice": { |
| 1506 | const slice = expr.slice; |
| 1507 | const lhs = zigAnalysis.exprs[slice.lhs]; |
| 1508 | const start = zigAnalysis.exprs[slice.start]; |
| 1509 | yield* ex(lhs, opts); |
| 1510 | yield Tok.l_bracket; |
| 1511 | yield* ex(start, opts); |
| 1512 | yield Tok.period; |
| 1513 | yield Tok.period; |
| 1514 | if (slice.end !== null) { |
| 1515 | const end = zigAnalysis.exprs[slice.end]; |
| 1516 | yield* ex(end, opts); |
| 1517 | } |
| 1518 | if (slice.sentinel !== null) { |
| 1519 | yield Tok.colon; |
| 1520 | const sent = zigAnalysis.exprs[slice.sentinel]; |
| 1521 | yield* ex(sent, opts); |
| 1522 | } |
| 1523 | yield Tok.r_brace; |
| 1524 | return; |
| 1525 | } |
| 1526 | |
| 1527 | case "sliceLength": { |
| 1528 | const slice = expr.sliceLength; |
| 1529 | const lhs = zigAnalysis.exprs[slice.lhs]; |
| 1530 | const start = zigAnalysis.exprs[slice.start]; |
| 1531 | const len = zigAnalysis.exprs[slice.len]; |
| 1532 | yield* ex(lhs, opts); |
| 1533 | yield Tok.l_bracket; |
| 1534 | yield* ex(start, opts); |
| 1535 | yield Tok.period; |
| 1536 | yield Tok.period; |
| 1537 | yield Tok.r_bracket; |
| 1538 | yield Tok.l_bracket; |
| 1539 | yield { src: "0", tag: Tag.number_literal }; |
| 1540 | yield Tok.period; |
| 1541 | yield Tok.period; |
| 1542 | yield* ex(len, opts); |
| 1543 | if (slice.sentinel !== null) { |
| 1544 | yield Tok.colon; |
| 1545 | const sent = zigAnalysis.exprs[slice.sentinel]; |
| 1546 | yield* ex(sent, opts); |
| 1547 | } |
| 1548 | yield Tok.r_brace; |
| 1549 | return; |
| 1550 | } |
| 1493 | 1551 | |
| 1494 | 1552 | case "string": { |
| 1495 | 1553 | yield { src: '"' + expr.string + '"', tag: Tag.string_literal }; |
| ... | ... | @@ -1952,6 +2010,55 @@ Happy writing! |
| 1952 | 2010 | return; |
| 1953 | 2011 | } |
| 1954 | 2012 | |
| 2013 | case "cmpxchgIndex": { |
| 2014 | const cmpxchg = zigAnalysis.exprs[expr.cmpxchgIndex]; |
| 2015 | yield* ex(cmpxchg, opts); |
| 2016 | return; |
| 2017 | } |
| 2018 | |
| 2019 | case "cmpxchg": { |
| 2020 | const type = zigAnalysis.exprs[expr.cmpxchg.type]; |
| 2021 | const ptr = zigAnalysis.exprs[expr.cmpxchg.ptr]; |
| 2022 | const expectedValue = zigAnalysis.exprs[expr.cmpxchg.expected_value]; |
| 2023 | const newValue = zigAnalysis.exprs[expr.cmpxchg.new_value]; |
| 2024 | const successOrder = zigAnalysis.exprs[expr.cmpxchg.success_order]; |
| 2025 | const failureOrder = zigAnalysis.exprs[expr.cmpxchg.failure_order]; |
| 2026 | |
| 2027 | let fnName = "@"; |
| 2028 | switch (expr.cmpxchg.name) { |
| 2029 | case "cmpxchg_strong": { |
| 2030 | fnName += "cmpxchgStrong"; |
| 2031 | break; |
| 2032 | } |
| 2033 | case "cmpxchg_weak": { |
| 2034 | fnName += "cmpxchgWeak"; |
| 2035 | break; |
| 2036 | } |
| 2037 | default: |
| 2038 | throw "Unexpected cmpxchg name: `" + expr.cmpxchg.name + "`!"; |
| 2039 | } |
| 2040 | yield { src: fnName, tag: Tag.builtin }; |
| 2041 | yield Tok.l_paren; |
| 2042 | yield* ex(type, opts); |
| 2043 | yield Tok.comma; |
| 2044 | yield Tok.space; |
| 2045 | yield* ex(ptr, opts); |
| 2046 | yield Tok.comma; |
| 2047 | yield Tok.space; |
| 2048 | yield* ex(expectedValue, opts); |
| 2049 | yield Tok.comma; |
| 2050 | yield Tok.space; |
| 2051 | yield* ex(newValue, opts); |
| 2052 | yield Tok.comma; |
| 2053 | yield Tok.space; |
| 2054 | yield* ex(successOrder, opts); |
| 2055 | yield Tok.comma; |
| 2056 | yield Tok.space; |
| 2057 | yield* ex(failureOrder, opts); |
| 2058 | yield Tok.r_paren; |
| 2059 | return; |
| 2060 | } |
| 2061 | |
| 1955 | 2062 | case "enumLiteral": { |
| 1956 | 2063 | let literal = expr.enumLiteral; |
| 1957 | 2064 | yield Tok.period; |
| ... | ... | @@ -2565,6 +2672,7 @@ Happy writing! |
| 2565 | 2672 | } |
| 2566 | 2673 | } |
| 2567 | 2674 | } |
| 2675 | |
| 2568 | 2676 | case "typeOf": { |
| 2569 | 2677 | const typeRefArg = zigAnalysis.exprs[expr.typeOf]; |
| 2570 | 2678 | yield { src: "@TypeOf", tag: Tag.builtin }; |
| ... | ... | @@ -2573,6 +2681,11 @@ Happy writing! |
| 2573 | 2681 | yield Tok.r_paren; |
| 2574 | 2682 | return; |
| 2575 | 2683 | } |
| 2684 | |
| 2685 | case "builtinField": { |
| 2686 | yield { src: expr.builtinField, tag: Tag.identifier }; |
| 2687 | return; |
| 2688 | } |
| 2576 | 2689 | } |
| 2577 | 2690 | |
| 2578 | 2691 | |