-
Notifications
You must be signed in to change notification settings - Fork 47k
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
[compiler][ez] Add types for Math.min, recursive global #30641
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,6 +136,17 @@ const TYPED_GLOBALS: Array<[string, BuiltInType]> = [ | |
returnValueKind: ValueKind.Primitive, | ||
}), | ||
], | ||
[ | ||
'min', | ||
// Math.min(value0, ..., valueN) | ||
addFunction(DEFAULT_SHAPES, [], { | ||
positionalParams: [], | ||
restParam: Effect.Read, | ||
returnType: {kind: 'Primitive'}, | ||
calleeEffect: Effect.Read, | ||
returnValueKind: ValueKind.Primitive, | ||
}), | ||
], | ||
]), | ||
], | ||
['Infinity', {kind: 'Primitive'}], | ||
|
@@ -455,11 +466,15 @@ for (const [name, type_] of TYPED_GLOBALS) { | |
DEFAULT_GLOBALS.set(name, type_); | ||
} | ||
|
||
// Recursive global type | ||
// Recursive global types | ||
DEFAULT_GLOBALS.set( | ||
'globalThis', | ||
addObject(DEFAULT_SHAPES, 'globalThis', TYPED_GLOBALS), | ||
); | ||
DEFAULT_GLOBALS.set( | ||
'global', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I debated on adding window but figured we should leave it out for now. I wonder if we want to handle |
||
addObject(DEFAULT_SHAPES, 'global', TYPED_GLOBALS), | ||
); | ||
|
||
export function installReAnimatedTypes( | ||
globals: GlobalRegistry, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whole bunch more
Math.*
stuff missing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, added min as
Math.min
andMath.max
differences surprised me a few times. Will go ahead and add a few others