Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/core.os.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// under -mm=own so is every Date method that calls one: a global Date lent to `d.getMonth()` was an
// error. The scalar ones too: a scalar declaration is taken as no-drops only in a module no function
// value can escape from, and the library, which declares non-scalar functions, is not one.
// @owned: these return a string their caller owns under -mm=rc - each body returns `s`, a view of
// @owned: these return a string their caller owns under -mm=rc and -mm=own - each body returns `s`, a view of
// its local char[], and a view the function returns is copied there (#481), so the caller is given
// a string of its own at +1. Unmarked, they were C functions to their callers: the result was
// copied again and the function's own string never given back (`toFixed` leaked one per call).
Expand Down
12 changes: 7 additions & 5 deletions src/lib.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
/// <reference path="generics/lib.generics.ts" />

// @owned: lib.ts defines what this file declares, compiled under the program's own memory model, so
// under -mm=rc each function here returns a reference its caller owns, as an imported function does.
// Without it the compiler can say nothing of these results: every call kept its +1 for good, and one
// declaration with a heap result was enough to stop any call through a function value from giving
// its result back. Never on a C function, nor on one that returns a pointer into a buffer
// (core/core.os.d.ts's convertNumber, timestamp_to_string, ...).
// under -mm=rc and -mm=own each function here returns a value its caller owns, as an imported function
// does - except where a declaration says it lends its result (`@lends`, or a result type `this`),
// which -mm=own goes by. Without it the compiler can say nothing of these results: under rc every call
// kept its +1 for good, and one declaration with a heap result was enough to stop any call through a
// function value from giving its result back; under own no result was ever given back. Never on a C
// function, nor on one that returns a pointer into a buffer (core/core.os.d.ts's convertNumber,
// timestamp_to_string, ...). A function lib.ts makes lend its result must say `@lends` here too.

@owned
declare function parseInt(val: string, radix?: int): int;
Expand Down
Loading