mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Merge branch 'master' of https://github.com/odin-lang/Odin
This commit is contained in:
@@ -1686,7 +1686,7 @@ centre_justify :: proc(str: string, length: int, pad: string, allocator := conte
|
|||||||
return clone(str, allocator)
|
return clone(str, allocator)
|
||||||
}
|
}
|
||||||
|
|
||||||
remains := length-1
|
remains := length-n
|
||||||
pad_len := rune_count(pad)
|
pad_len := rune_count(pad)
|
||||||
|
|
||||||
b: Builder
|
b: Builder
|
||||||
@@ -1702,14 +1702,14 @@ centre_justify :: proc(str: string, length: int, pad: string, allocator := conte
|
|||||||
return to_string(b)
|
return to_string(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
// left_justify returns a string with a pad string at left side if the str's rune length is smaller than length
|
// left_justify returns a string with a pad string at right side if the str's rune length is smaller than length
|
||||||
left_justify :: proc(str: string, length: int, pad: string, allocator := context.allocator) -> string {
|
left_justify :: proc(str: string, length: int, pad: string, allocator := context.allocator) -> string {
|
||||||
n := rune_count(str)
|
n := rune_count(str)
|
||||||
if n >= length || pad == "" {
|
if n >= length || pad == "" {
|
||||||
return clone(str, allocator)
|
return clone(str, allocator)
|
||||||
}
|
}
|
||||||
|
|
||||||
remains := length-1
|
remains := length-n
|
||||||
pad_len := rune_count(pad)
|
pad_len := rune_count(pad)
|
||||||
|
|
||||||
b: Builder
|
b: Builder
|
||||||
@@ -1724,14 +1724,14 @@ left_justify :: proc(str: string, length: int, pad: string, allocator := context
|
|||||||
return to_string(b)
|
return to_string(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
// right_justify returns a string with a pad string at right side if the str's rune length is smaller than length
|
// right_justify returns a string with a pad string at left side if the str's rune length is smaller than length
|
||||||
right_justify :: proc(str: string, length: int, pad: string, allocator := context.allocator) -> string {
|
right_justify :: proc(str: string, length: int, pad: string, allocator := context.allocator) -> string {
|
||||||
n := rune_count(str)
|
n := rune_count(str)
|
||||||
if n >= length || pad == "" {
|
if n >= length || pad == "" {
|
||||||
return clone(str, allocator)
|
return clone(str, allocator)
|
||||||
}
|
}
|
||||||
|
|
||||||
remains := length-1
|
remains := length-n
|
||||||
pad_len := rune_count(pad)
|
pad_len := rune_count(pad)
|
||||||
|
|
||||||
b: Builder
|
b: Builder
|
||||||
|
|||||||
+4
-2
@@ -1643,8 +1643,10 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_params, bool *is
|
|||||||
bool valid = false;
|
bool valid = false;
|
||||||
if (is_type_proc(op.type)) {
|
if (is_type_proc(op.type)) {
|
||||||
Entity *proc_entity = entity_from_expr(op.expr);
|
Entity *proc_entity = entity_from_expr(op.expr);
|
||||||
valid = proc_entity != nullptr;
|
valid = (proc_entity != nullptr) && (op.value.kind == ExactValue_Procedure);
|
||||||
poly_const = exact_value_procedure(proc_entity->identifier.load() ? proc_entity->identifier.load() : op.expr);
|
if (valid) {
|
||||||
|
poly_const = exact_value_procedure(proc_entity->identifier.load() ? proc_entity->identifier.load() : op.expr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
if (op.mode == Addressing_Constant) {
|
if (op.mode == Addressing_Constant) {
|
||||||
|
|||||||
Reference in New Issue
Block a user