Repository navigation
Trait objects' TypeId #605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
b7e36f3
chore(quest): claim quest/m3/ts-dyn.md
kixelated 7bdfc32
feat(ts): translate TypeId, TypeId::of, and Any::type_id of values an…
kixelated 91536e8
quest: finish quest/m3/ts-dyn.md, as TypeId and Any::type_id translate
kixelated 982f05f
Merge remote-tracking branch 'origin/main' into feat/ts-dynamic-types
kixelated d809c15
Merge remote-tracking branch 'origin/main' into HEAD
kixelated baa4c93
fix(ts): write TypeId's Debug in std's sequence of writes
kixelated b40e856
Merge remote-tracking branch 'origin/main' into HEAD
kixelated a57134e
test(ts): snapshot TypeId Debug's capped-writer case
kixelated 862ded0
quest(m3): drop the spike's link to the finished ts-dyn quest
kixelated 3d7e6ea
style(ts): format the TypeId capped-writer case
kixelated ad28c72
Merge remote-tracking branch 'origin/main' into HEAD
kixelated 729a812
Merge remote-tracking branch 'origin/main' into HEAD
kixelated 0b5b60f
fix(ts): a TypeId constant behind a reference, and a hook payload's type
kixelated 375e5a0
Merge remote-tracking branch 'origin/main' into quest/m3/ts-dyn
kixelated 339c7e1
Merge remote-tracking branch 'origin/main' into quest/m3/ts-dyn
kixelated 33590bb
Merge branch 'base' into pr-605
a41df84
chore(ts): regenerate TypeId fixture snapshots after base merge
bc45441
Merge branch 'base' into pr-605
eca1fa7
test(ts): regenerate TypeId snapshots without incremental compilation
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| // Generated by rust2-ts. Do not edit. | ||
|
|
||
| export type Any = object; | ||
| import * as rs from "../rs.ts"; | ||
|
|
||
| export type Any = { typeId$Any: () => rs.TypeId }; | ||
|
|
||
| //# sourceMappingURL=any.Any.ts.map | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // Generated by rust2-ts. Do not edit. | ||
|
|
||
| import * as rs from "../../rs.ts"; | ||
|
|
||
| export function toDigit$14z95r4(self: rs.char, radix: rs.u32): rs.u32 | undefined { | ||
| let value!: rs.u32; | ||
| if (radix >= 2) { | ||
| if (radix <= 36) { | ||
| b1: { | ||
| if (self > 57) { | ||
| if (radix > 10) { | ||
| value = rs.u32Add((rs.u32WrappingSub(self as rs.u32, 65 as rs.u32) & 4294967263) >>> 0, 10); | ||
| break b1; | ||
| } | ||
| } | ||
| value = rs.u32WrappingSub(self as rs.u32, 48 as rs.u32); | ||
| } | ||
| if (!(value < radix)) { | ||
| return undefined; | ||
| } | ||
| return value; | ||
| } | ||
| } | ||
| rs.panicFmt(["to_digit: invalid radix -- radix must be in the range 2 to 36 inclusive"]); | ||
| } | ||
|
|
||
| //# sourceMappingURL=methods.ts.map |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,181 @@ | ||
| // Generated by rust2-ts. Do not edit. | ||
|
|
||
| import * as rs from "../rs.ts"; | ||
| import { toDigit$14z95r4 } from "../core/char/methods.ts"; | ||
|
|
||
| export function canNotOverflow$05izqtt(radix: rs.u32, isSignedTy: boolean, _digitsData: Uint8Array, _digitsStart: number, digitsLen: number): boolean { | ||
| if (!(radix <= 16)) { | ||
| return false; | ||
| } | ||
| return digitsLen <= rs.usizeSub(rs.usizeMul(16, 2), isSignedTy ? 1 : 0); | ||
| } | ||
|
|
||
| export function fromAsciiBytesRadixPanic(radix: rs.u32): never { | ||
| doPanic$1tugyvz(radix); | ||
| } | ||
|
|
||
| export function doPanic$1tugyvz(radix: rs.u32): never { | ||
| runtime$09k496w(radix); | ||
| } | ||
|
|
||
| export function runtime$09k496w(radix: rs.u32): never { | ||
| rs.panicFmt(["from_ascii_bytes_radix: radix must lie in the range `[2, 36]` - found ", (f: rs.Formatter) => rs.u32Display(radix, f)]); | ||
| } | ||
|
|
||
| export function fromAsciiBytesRadixImpl$0paozdl(src: rs.ByteSlice, radix: rs.u32): rs.Result<rs.u128, rs.ParseIntError> { | ||
| let _12_0!: boolean; | ||
| let _12_1Data!: Uint8Array; | ||
| let _12_1Start!: number; | ||
| let _12_1Len!: number; | ||
| if (!(2 > radix)) { | ||
| if (!(radix > 36)) { | ||
| if (!(src.length === 0)) { | ||
| const isSignedTy: boolean = rs.u128Gt(0, 0); | ||
| if (src.length === 1) { | ||
| const value7 = src.data[src.start]; | ||
| if (value7 === 43 || value7 === 45) { | ||
| return rs.Err({ kind: "InvalidDigit" as rs.IntErrorKind }); | ||
| } | ||
| } | ||
| b3: { | ||
| if (src.length >= 1) { | ||
| const value8 = src.data[src.start]; | ||
| if (value8 === 43) { | ||
| _12_0 = true; | ||
| _12_1Data = src.data; | ||
| _12_1Start = src.start + 1; | ||
| _12_1Len = src.length - 1; | ||
| break b3; | ||
| } | ||
| if (value8 === 45) { | ||
| const rest2: rs.ByteSlice = rs.byteSliceRange(src, 1); | ||
| if (isSignedTy) { | ||
| _12_0 = false; | ||
| _12_1Data = rest2.data; | ||
| _12_1Start = rest2.start; | ||
| _12_1Len = rest2.length; | ||
| break b3; | ||
| } | ||
| } | ||
| } | ||
| _12_0 = true; | ||
| _12_1Data = src.data; | ||
| _12_1Start = src.start; | ||
| _12_1Len = src.length; | ||
| } | ||
| const isPositive: boolean = _12_0; | ||
| let digitsData: Uint8Array = _12_1Data; | ||
| let digitsStart: number = _12_1Start; | ||
| let digitsLen: number = _12_1Len; | ||
| let result: rs.u128 = 0; | ||
| b5: { | ||
| if (!canNotOverflow$05izqtt(radix, isSignedTy, digitsData, digitsStart, digitsLen)) { | ||
| if (!isPositive) { | ||
| while (true) { | ||
| if (!(digitsLen >= 1)) { | ||
| break b5; | ||
| } | ||
| const c4: rs.u8 = digitsData[digitsStart]; | ||
| const restData5: Uint8Array = digitsData; | ||
| const restStart5: number = digitsStart + 1; | ||
| const restLen5: number = digitsLen - 1; | ||
| const mul2: rs.u128 | undefined = rs.u128CheckedMul(result, radix as rs.u128); | ||
| const _92: rs.u32 | undefined = toDigit$14z95r4(c4 as rs.char, radix); | ||
| if (_92 === undefined) { | ||
| return rs.Err({ kind: "InvalidDigit" as rs.IntErrorKind }); | ||
| } | ||
| const x4: rs.u128 = _92 as rs.u128; | ||
| if (mul2 === undefined) { | ||
| return rs.Err({ kind: "NegOverflow" as rs.IntErrorKind }); | ||
| } | ||
| result = mul2; | ||
| const _103: rs.u128 | undefined = rs.u128CheckedSub(result, x4); | ||
| if (_103 === undefined) { | ||
| return rs.Err({ kind: "NegOverflow" as rs.IntErrorKind }); | ||
| } | ||
| result = _103; | ||
| digitsData = restData5; | ||
| digitsStart = restStart5; | ||
| digitsLen = restLen5; | ||
| } | ||
| } | ||
| while (true) { | ||
| if (!(digitsLen >= 1)) { | ||
| break b5; | ||
| } | ||
| const c3: rs.u8 = digitsData[digitsStart]; | ||
| const restData4: Uint8Array = digitsData; | ||
| const restStart4: number = digitsStart + 1; | ||
| const restLen4: number = digitsLen - 1; | ||
| const mul: rs.u128 | undefined = rs.u128CheckedMul(result, radix as rs.u128); | ||
| const _67: rs.u32 | undefined = toDigit$14z95r4(c3 as rs.char, radix); | ||
| if (_67 === undefined) { | ||
| return rs.Err({ kind: "InvalidDigit" as rs.IntErrorKind }); | ||
| } | ||
| const x3: rs.u128 = _67 as rs.u128; | ||
| if (mul === undefined) { | ||
| return rs.Err({ kind: "PosOverflow" as rs.IntErrorKind }); | ||
| } | ||
| result = mul; | ||
| const _78: rs.u128 | undefined = rs.u128CheckedAdd(result, x3); | ||
| if (_78 === undefined) { | ||
| return rs.Err({ kind: "PosOverflow" as rs.IntErrorKind }); | ||
| } | ||
| result = _78; | ||
| digitsData = restData4; | ||
| digitsStart = restStart4; | ||
| digitsLen = restLen4; | ||
| } | ||
| } | ||
| if (!isPositive) { | ||
| while (true) { | ||
| if (!(digitsLen >= 1)) { | ||
| break b5; | ||
| } | ||
| const c2: rs.u8 = digitsData[digitsStart]; | ||
| const restData3: Uint8Array = digitsData; | ||
| const restStart3: number = digitsStart + 1; | ||
| const restLen3: number = digitsLen - 1; | ||
| result = rs.u128WrappingMul(result, radix as rs.u128); | ||
| const _49: rs.u32 | undefined = toDigit$14z95r4(c2 as rs.char, radix); | ||
| if (_49 === undefined) { | ||
| return rs.Err({ kind: "InvalidDigit" as rs.IntErrorKind }); | ||
| } | ||
| result = rs.u128WrappingSub(result, _49 as rs.u128); | ||
| digitsData = restData3; | ||
| digitsStart = restStart3; | ||
| digitsLen = restLen3; | ||
| } | ||
| } | ||
| while (true) { | ||
| if (!(digitsLen >= 1)) { | ||
| break b5; | ||
| } | ||
| const c: rs.u8 = digitsData[digitsStart]; | ||
| const restData2: Uint8Array = digitsData; | ||
| const restStart2: number = digitsStart + 1; | ||
| const restLen2: number = digitsLen - 1; | ||
| result = rs.u128WrappingMul(result, radix as rs.u128); | ||
| const _32: rs.u32 | undefined = toDigit$14z95r4(c as rs.char, radix); | ||
| if (_32 === undefined) { | ||
| return rs.Err({ kind: "InvalidDigit" as rs.IntErrorKind }); | ||
| } | ||
| result = rs.u128WrappingAdd(result, _32 as rs.u128); | ||
| digitsData = restData2; | ||
| digitsStart = restStart2; | ||
| digitsLen = restLen2; | ||
| } | ||
| } | ||
| return rs.Ok(result); | ||
| } | ||
| return rs.Err({ kind: "Empty" as rs.IntErrorKind }); | ||
| } | ||
| } | ||
| fromAsciiBytesRadixPanic(radix); | ||
| } | ||
|
|
||
| export function fromStrRadix$09i2k2a(src: string, radix: rs.u32): rs.Result<rs.u128, rs.ParseIntError> { | ||
| return fromAsciiBytesRadixImpl$0paozdl(rs.stringAsBytes(src), radix); | ||
| } | ||
|
|
||
| //# sourceMappingURL=num.ts.map |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.