| author | |
| committer | |
| log | bfceb186319f52011762129c879abbe27eaa0161 |
| tree | c6d875f2168c925ec6ffa15412be849c4a35c55d |
| parent | e269caae02778c5b15a101c42d2d2d5150af59c8 |
4 files changed, 14 insertions(+), 25 deletions(-)
src/analyze.cpp+2-1| ... | ... | @@ -3648,7 +3648,8 @@ static TypeTableEntry *analyze_expression(CodeGen *g, ImportTableEntry *import, |
| 3648 | 3648 | return_type = analyze_string_literal_expr(g, import, context, expected_type, node); |
| 3649 | 3649 | break; |
| 3650 | 3650 | case NodeTypeCharLiteral: |
| 3651 | return_type = g->builtin_types.entry_u8; | |
| 3651 | return_type = resolve_expr_const_val_as_unsigned_num_lit(g, node, expected_type, | |
| 3652 | node->data.char_literal.value); | |
| 3652 | 3653 | break; |
| 3653 | 3654 | case NodeTypeBoolLiteral: |
| 3654 | 3655 | return_type = resolve_expr_const_val_as_bool(g, node, node->data.bool_literal.value); |
src/codegen.cpp+4-16| ... | ... | @@ -1828,12 +1828,6 @@ static LLVMValueRef gen_var_decl_expr(CodeGen *g, AstNode *node) { |
| 1828 | 1828 | get_resolved_expr(node)->block_context, false, &init_val); |
| 1829 | 1829 | } |
| 1830 | 1830 | |
| 1831 | static LLVMValueRef gen_error_literal(CodeGen *g, AstNode *node) { | |
| 1832 | assert(node->type == NodeTypeErrorLiteral); | |
| 1833 | ||
| 1834 | zig_panic("TODO gen_error_literal"); | |
| 1835 | } | |
| 1836 | ||
| 1837 | 1831 | static LLVMValueRef gen_symbol(CodeGen *g, AstNode *node) { |
| 1838 | 1832 | assert(node->type == NodeTypeSymbol); |
| 1839 | 1833 | VariableTableEntry *variable = node->data.symbol_expr.variable; |
| ... | ... | @@ -1953,12 +1947,6 @@ static LLVMValueRef gen_expr(CodeGen *g, AstNode *node) { |
| 1953 | 1947 | return gen_slice_expr(g, node); |
| 1954 | 1948 | case NodeTypeFieldAccessExpr: |
| 1955 | 1949 | return gen_field_access_expr(g, node, false); |
| 1956 | case NodeTypeNullLiteral: | |
| 1957 | // caught by constant expression eval codegen | |
| 1958 | zig_unreachable(); | |
| 1959 | case NodeTypeUndefinedLiteral: | |
| 1960 | // caught by constant expression eval codegen | |
| 1961 | zig_unreachable(); | |
| 1962 | 1950 | case NodeTypeIfBoolExpr: |
| 1963 | 1951 | return gen_if_bool_expr(g, node); |
| 1964 | 1952 | case NodeTypeIfVarExpr: |
| ... | ... | @@ -1969,10 +1957,6 @@ static LLVMValueRef gen_expr(CodeGen *g, AstNode *node) { |
| 1969 | 1957 | return gen_for_expr(g, node); |
| 1970 | 1958 | case NodeTypeAsmExpr: |
| 1971 | 1959 | return gen_asm_expr(g, node); |
| 1972 | case NodeTypeErrorLiteral: | |
| 1973 | return gen_error_literal(g, node); | |
| 1974 | case NodeTypeCharLiteral: | |
| 1975 | return LLVMConstInt(LLVMInt8Type(), node->data.char_literal.value, false); | |
| 1976 | 1960 | case NodeTypeSymbol: |
| 1977 | 1961 | return gen_symbol(g, node); |
| 1978 | 1962 | case NodeTypeBlock: |
| ... | ... | @@ -2000,9 +1984,13 @@ static LLVMValueRef gen_expr(CodeGen *g, AstNode *node) { |
| 2000 | 1984 | return gen_container_init_expr(g, node); |
| 2001 | 1985 | case NodeTypeSwitchExpr: |
| 2002 | 1986 | return gen_switch_expr(g, node); |
| 1987 | case NodeTypeErrorLiteral: | |
| 2003 | 1988 | case NodeTypeNumberLiteral: |
| 2004 | 1989 | case NodeTypeBoolLiteral: |
| 2005 | 1990 | case NodeTypeStringLiteral: |
| 1991 | case NodeTypeCharLiteral: | |
| 1992 | case NodeTypeNullLiteral: | |
| 1993 | case NodeTypeUndefinedLiteral: | |
| 2006 | 1994 | // caught by constant expression eval codegen |
| 2007 | 1995 | zig_unreachable(); |
| 2008 | 1996 | case NodeTypeRoot: |
std/rand.zig+3-3| ... | ... | @@ -1,16 +1,16 @@ |
| 1 | 1 | // Mersenne Twister |
| 2 | const ARRAY_SIZE : i16 = 624; | |
| 2 | const ARRAY_SIZE = 624; | |
| 3 | 3 | |
| 4 | 4 | /// Use `rand_init` to initialize this state. |
| 5 | 5 | pub struct Rand { |
| 6 | 6 | array: [ARRAY_SIZE]u32, |
| 7 | index: @typeof(ARRAY_SIZE), | |
| 7 | index: isize, | |
| 8 | 8 | |
| 9 | 9 | /// Initialize random state with the given seed. |
| 10 | 10 | pub fn init(r: &Rand, seed: u32) => { |
| 11 | 11 | r.index = 0; |
| 12 | 12 | r.array[0] = seed; |
| 13 | var i : @typeof(ARRAY_SIZE) = 1; | |
| 13 | var i : isize = 1; | |
| 14 | 14 | var prev_value: u64 = seed; |
| 15 | 15 | while (i < ARRAY_SIZE) { |
| 16 | 16 | r.array[i] = u32((prev_value ^ (prev_value << 30)) * 0x6c078965 + u32(i)); |
std/std.zig+5-5| ... | ... | @@ -1,9 +1,9 @@ |
| 1 | 1 | import "syscall.zig"; |
| 2 | 2 | import "errno.zig"; |
| 3 | 3 | |
| 4 | pub const stdin_fileno : isize = 0; | |
| 5 | pub const stdout_fileno : isize = 1; | |
| 6 | pub const stderr_fileno : isize = 2; | |
| 4 | pub const stdin_fileno = 0; | |
| 5 | pub const stdout_fileno = 1; | |
| 6 | pub const stderr_fileno = 2; | |
| 7 | 7 | |
| 8 | 8 | /* |
| 9 | 9 | pub var stdin = InStream { |
| ... | ... | @@ -34,8 +34,8 @@ pub %.BadPerm; |
| 34 | 34 | pub %.PipeFail; |
| 35 | 35 | */ |
| 36 | 36 | |
| 37 | //const buffer_size = 4 * 1024; | |
| 38 | const max_u64_base10_digits: isize = 20; | |
| 37 | const buffer_size = 4 * 1024; | |
| 38 | const max_u64_base10_digits = 20; | |
| 39 | 39 | |
| 40 | 40 | /* |
| 41 | 41 | pub struct OutStream { |