Skip to content

Commit

Permalink
execute julfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Jul 24, 2024
1 parent 48ecdc4 commit 4bed7c0
Show file tree
Hide file tree
Showing 19 changed files with 102 additions and 109 deletions.
2 changes: 1 addition & 1 deletion src/julec/obj/cxx/expr.jule
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ impl exprCoder {
}

fn structureSub(mut &self, mut m: &StructSubIdentExprModel) {
self.possibleRefExpr(m.Expr.Model)
self.possibleRefExpr(m.Expr.Model)
if m.Field == nil {
ret
}
Expand Down
2 changes: 1 addition & 1 deletion std/fs/stat.jule
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use sys for std::sys

enum statusMode {
Na: 0 << 0,
Na: 0 << 0,
Dir: 1 << 0,
Reg: 1 << 1,
}
Expand Down
18 changes: 9 additions & 9 deletions std/hash/fnv/fnv.jule
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ use bits for std::math::bits
use hash for std::hash
use byteorder for std::internal::byteorder

const offset32 = 2166136261
const offset64 = 14695981039346656037
const offset128Lower = 0x62b821756295c58d
const offset32 = 2166136261
const offset64 = 14695981039346656037
const offset128Lower = 0x62b821756295c58d
const offset128Higher = 0x6c62272e07bb0142
const prime32 = 16777619
const prime64 = 1099511628211
const prime128Lower = 0x13b
const prime128Shift = 24
const prime32 = 16777619
const prime64 = 1099511628211
const prime128Lower = 0x13b
const prime128Shift = 24

struct fnv32 {
s: u32
Expand Down Expand Up @@ -165,7 +165,7 @@ impl hash::Hash for fnv128 {
fn Write(mut self, d: []byte)!: int {
for _, c in d {
let (mut s0, s1) = bits::Mul64(prime128Lower, self.s[1])
s0 += self.s[1]<<prime128Shift + prime128Lower*self.s[0]
s0 += self.s[1] << prime128Shift + prime128Lower * self.s[0]
self.s[1] = s1
self.s[0] = s0
self.s[1] ^= u64(c)
Expand Down Expand Up @@ -196,7 +196,7 @@ impl hash::Hash for fnv128a {
for _, c in d {
self.s[1] ^= u64(c)
let (mut s0, s1) = bits::Mul64(prime128Lower, self.s[1])
s0 += self.s[1]<<prime128Shift + prime128Lower*self.s[0]
s0 += self.s[1] << prime128Shift + prime128Lower * self.s[0]
self.s[1] = s1
self.s[0] = s0
}
Expand Down
72 changes: 33 additions & 39 deletions std/internal/byteorder/byteorder.jule
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
// ====================================================

fn LeU16(b: []byte): u16 {
ret u16(b[0]) | u16(b[1])<<8
ret u16(b[0]) | u16(b[1]) << 8
}

fn LePutU16(mut b: []byte, v: u16) {
Expand All @@ -50,12 +50,11 @@ fn LePutU16(mut b: []byte, v: u16) {
fn LeAppendU16(mut b: []byte, v: u16): []byte {
ret append(b,
byte(v),
byte(v>>8),
)
byte(v >> 8))
}

fn LeU32(b: []byte): u32 {
ret u32(b[3])<<24 | u32(b[2])<<16 | u32(b[1])<<8 | u32(b[0])
ret u32(b[3]) << 24 | u32(b[2]) << 16 | u32(b[1]) << 8 | u32(b[0])
}

fn LePutU32(mut b: []byte, v: u32) {
Expand All @@ -68,15 +67,14 @@ fn LePutU32(mut b: []byte, v: u32) {
fn LeAppendU32(mut b: []byte, v: u32): []byte {
ret append(b,
byte(v),
byte(v>>8),
byte(v>>16),
byte(v>>24),
)
byte(v >> 8),
byte(v >> 16),
byte(v >> 24))
}

fn LeU64(mut b: []byte): u64 {
ret u64(b[7])<<56 | u64(b[6])<<48 | u64(b[5])<<40 | u64(b[4])<<32 |
u64(b[3])<<24 | u64(b[2])<<16 | u64(b[1])<<8 | u64(b[0])
ret u64(b[7]) << 56 | u64(b[6]) << 48 | u64(b[5]) << 40 | u64(b[4]) << 32 |
u64(b[3]) << 24 | u64(b[2]) << 16 | u64(b[1]) << 8 | u64(b[0])
}

fn LePutU64(mut b: []byte, v: u64) {
Expand All @@ -93,18 +91,17 @@ fn LePutU64(mut b: []byte, v: u64) {
fn LeAppendU64(mut b: []byte, v: u64): []byte {
ret append(b,
byte(v),
byte(v>>8),
byte(v>>16),
byte(v>>24),
byte(v>>32),
byte(v>>40),
byte(v>>48),
byte(v>>56),
)
byte(v >> 8),
byte(v >> 16),
byte(v >> 24),
byte(v >> 32),
byte(v >> 40),
byte(v >> 48),
byte(v >> 56))
}

fn BeU16(b: []byte): u16 {
ret u16(b[1]) | u16(b[0])<<8
ret u16(b[1]) | u16(b[0]) << 8
}

fn BePutU16(mut b: []byte, v: u16) {
Expand All @@ -114,13 +111,12 @@ fn BePutU16(mut b: []byte, v: u16) {

fn BeAppendU16(mut b: []byte, v: u16): []byte {
ret append(b,
byte(v>>8),
byte(v),
)
byte(v >> 8),
byte(v))
}

fn BeU32(b: []byte): u32 {
ret u32(b[0])<<24 | u32(b[1])<<16 | u32(b[2])<<8 | u32(b[3])
ret u32(b[0]) << 24 | u32(b[1]) << 16 | u32(b[2]) << 8 | u32(b[3])
}

fn BePutU32(mut b: []byte, v: u32) {
Expand All @@ -132,16 +128,15 @@ fn BePutU32(mut b: []byte, v: u32) {

fn BeAppendU32(mut b: []byte, v: u32): []byte {
ret append(b,
byte(v>>24),
byte(v>>16),
byte(v>>8),
byte(v),
)
byte(v >> 24),
byte(v >> 16),
byte(v >> 8),
byte(v))
}

fn BeU64(b: []byte): u64 {
ret u64(b[7]) | u64(b[6])<<8 | u64(b[5])<<16 | u64(b[4])<<24 |
u64(b[3])<<32 | u64(b[2])<<40 | u64(b[1])<<48 | u64(b[0])<<56
ret u64(b[7]) | u64(b[6]) << 8 | u64(b[5]) << 16 | u64(b[4]) << 24 |
u64(b[3]) << 32 | u64(b[2]) << 40 | u64(b[1]) << 48 | u64(b[0]) << 56
}

fn BePutU64(mut b: []byte, v: u64) {
Expand All @@ -157,13 +152,12 @@ fn BePutU64(mut b: []byte, v: u64) {

fn BeAppendU64(mut b: []byte, v: u64): []byte {
ret append(b,
byte(v>>56),
byte(v>>48),
byte(v>>40),
byte(v>>32),
byte(v>>24),
byte(v>>16),
byte(v>>8),
byte(v),
)
byte(v >> 56),
byte(v >> 48),
byte(v >> 40),
byte(v >> 32),
byte(v >> 24),
byte(v >> 16),
byte(v >> 8),
byte(v))
}
10 changes: 5 additions & 5 deletions std/internal/conv/atoi_test.jule
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use std::testing::{T}

struct atoiCase {
s: str
n: int
s: str
n: int
ok: bool
}

Expand All @@ -23,9 +23,9 @@ static casesAtoi: []atoiCase = [
]

struct xbtoiCase {
s: []byte
n: int
i: int
s: []byte
n: int
i: int
ok: bool
}

Expand Down
2 changes: 1 addition & 1 deletion std/internal/fastbytes/fastbytes.jule
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn FindLastByte(s: []byte, b: byte): int {
ret -1
}
let first = &s[0]
let mut it = &s[len(s) - 1]
let mut it = &s[len(s)-1]
for it >= first; it-- {
unsafe {
if (*it == b) {
Expand Down
8 changes: 4 additions & 4 deletions std/internal/fastbytes/fastbytes_test.jule
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ struct findByteCase {
}

static casesEqual: []equalCase = [
{[1, 2, 3 , 4, 5], [1, 2, 3, 4, 5], true},
{[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], true},
{[]byte("abcd üöpşç"), []byte("abcd üöpşç"), true},
{[], [], true},
{nil, nil, true},
{[], nil, true},
{[1, 2, 3 , 4, 5], [1, 2, 3, 4, 5, 6], false},
{[1, 2, 3 , 4, 5], [1, 2, 3, 4], false},
{[1, 2, 3, 4], [1, 2, 3 , 4, 5], false},
{[1, 2, 3, 4, 5], [1, 2, 3, 4, 5, 6], false},
{[1, 2, 3, 4, 5], [1, 2, 3, 4], false},
{[1, 2, 3, 4], [1, 2, 3, 4, 5], false},
{[1, 2, 3, 4], [], false},
{[1, 2, 3, 4], nil, false},
]
Expand Down
2 changes: 1 addition & 1 deletion std/internal/nosafe/mem.jule
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ fn ClearStr(mut &s: str) {
unsafe {
integ::Emit("({}).buffer.clear()", s)
}
}
}
14 changes: 7 additions & 7 deletions std/jule/ast/node.jule
Original file line number Diff line number Diff line change
Expand Up @@ -598,13 +598,13 @@ struct MatchCase {

// Use declaration statement.
struct UseDecl {
Token: &Token
LinkPath: str // Use declaration path string.
Alias: str
Full: bool // Full implicit import.
Selected: []&Token
Binded: bool // Bind use declaration.
Std: bool // Standard package use declaration.
Token: &Token
LinkPath: str // Use declaration path string.
Alias: str
Full: bool // Full implicit import.
Selected: []&Token
Binded: bool // Bind use declaration.
Std: bool // Standard package use declaration.
}

// Enum item.
Expand Down
2 changes: 1 addition & 1 deletion std/jule/lex/lex.jule
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ fn Lex(mut f: &File, mode: LexMode): []Log {
mode: mode,
file: f,
pos: 0,
row: -1,// For true row
row: -1, // For true row
}

lex.newLine()
Expand Down
2 changes: 1 addition & 1 deletion std/jule/parser/parser.jule
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ impl parser {
}
ret &Directive{
Tag: tokens[1],
Args: tokens[2:],// Start 2 to skip '#', and tag tokens.
Args: tokens[2:], // Start 2 to skip '#', and tag tokens.
}
}

Expand Down
2 changes: 1 addition & 1 deletion std/jule/parser/type.jule
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl typeBuilder {
ret &TypeDecl{
Token: token,
Kind: &PtrTypeDecl{
Elem: nil,// Set Elem as nil for unsafe pointer (*unsafe) type.
Elem: nil, // Set Elem as nil for unsafe pointer (*unsafe) type.
},
}
}
Expand Down
8 changes: 4 additions & 4 deletions std/jule/sema/comptime.jule
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ impl comptimeTypeInfo {
Kind: &TypeKind{
Kind: &comptimeStructFields{
fields: s.Fields,
}
},
},
}
}
Expand All @@ -779,7 +779,7 @@ impl comptimeTypeInfo {
Kind: &TypeKind{
Kind: &comptimeEnumFields{
fields: enm.Items,
}
},
},
}
}
Expand All @@ -801,7 +801,7 @@ impl comptimeTypeInfo {
Kind: &TypeKind{
Kind: &comptimeStatics{
fields: s.Statics,
}
},
},
}
}
Expand Down Expand Up @@ -968,7 +968,7 @@ impl comptimeTypeInfo {
ret &Data{
Kind: &TypeKind{
Kind: &comptimeParams{params: f.Params},
}
},
}
}

Expand Down
4 changes: 2 additions & 2 deletions std/jule/sema/eval.jule
Original file line number Diff line number Diff line change
Expand Up @@ -3451,7 +3451,7 @@ impl binaryEval {
| TokenKind.Eqs
| TokenKind.NotEq:
ret &Data{
Kind: primBool
Kind: primBool,
}
|:
self.e.pushErr(self.op, LogMsg.OperatorNotForJuleType, self.op.Kind, TokenKind.Nil)
Expand Down Expand Up @@ -3979,7 +3979,7 @@ impl binaryEval {
fn checkSpecialCases(mut self) {
if !self.l.Kind.Comparable() && !self.r.Kind.IsNil() {
self.e.pushErr(self.op, LogMsg.TypeIsNotComparable, self.l.Kind.Str())
} else if !self.r.Kind.Comparable() && !self.l.Kind.IsNil() {
} else if !self.r.Kind.Comparable() && !self.l.Kind.IsNil() {
self.e.pushErr(self.op, LogMsg.TypeIsNotComparable, self.r.Kind.Str())
}
}
Expand Down
2 changes: 1 addition & 1 deletion std/jule/sema/scope.jule
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,7 @@ impl scopeChecker {
ret def
}

fn checkComptimePanic(mut &self, callToken: &Token, &s: &Scope, ) {
fn checkComptimePanic(mut &self, callToken: &Token, &s: &Scope) {
if len(s.Stmts) != 1 {
ret
}
Expand Down
8 changes: 4 additions & 4 deletions std/jule/sema/sema.jule
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ impl commonSemaMeta {
// Accepts tables as files of package.
struct Sema {
errors: []Log
files: []&SymbolTable // Package files.
file: &SymbolTable // Current package file.
files: []&SymbolTable // Package files.
file: &SymbolTable // Current package file.
flags: SemaFlag
meta: &commonSemaMeta
}
Expand Down Expand Up @@ -1271,7 +1271,7 @@ impl Sema {
|:
panic("unimplemented enum int type, this panic call should be unrechable")
}

let mut eval = self.eval(self)
let mut n = Int(0)
let mut first = e.Items[0]
Expand Down Expand Up @@ -2180,7 +2180,7 @@ impl Sema {
}

if v.Constant {
let comptime = v.Value.Data.Kind.comptime()
let comptime = v.Value.Data.Kind.comptime()
if !v.Value.Data.IsConst() && !comptime {
self.pushErr(v.Value.Expr.Token, LogMsg.ExprNotConst)
}
Expand Down
Loading

0 comments on commit 4bed7c0

Please sign in to comment.