-
Notifications
You must be signed in to change notification settings - Fork 32
Typed modules #331
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
Typed modules #331
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
c8ada3d
Typed Rune module using decorators
tohlh b8a247d
Using "placeholder class" for representing module types
tohlh 378b23e
Merge branch 'source-academy:master' into typed-modules
tohlh c300a62
Remove unwanted line
tohlh 4a67585
Add types to Curve module
tohlh f780688
Rename type map decorators
tohlh 6ef61ca
Add type information for RunDisplay
tohlh b9634f2
Merge branch 'master' into typed-modules
RichDom2185 0e896ff
Merge branch 'master' into typed-modules
RichDom2185 c82fcec
Organize imports
RichDom2185 bac8e10
Favor destructuring for safety and readability
RichDom2185 6463508
Restore unintentionally deleted export
RichDom2185 935dabf
Merge branch 'master' into typed-modules
RichDom2185 ec07147
Add comments for clarification
tohlh 6c9e8a9
Merge branch 'master' into typed-modules
RichDom2185 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 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,123 @@ | ||
| import { classDeclaration, typeDeclaration, functionDeclaration } from '../../typings/type_map'; | ||
|
|
||
| @classDeclaration('Point') | ||
| export class Point {} | ||
|
|
||
| @classDeclaration('AnimatedCurve') | ||
| export class AnimatedCurve{} | ||
|
|
||
| @typeDeclaration('(u: number) => Point') | ||
| export class Curve {} | ||
|
|
||
| @typeDeclaration('(t: number) => Curve') | ||
| export class CurveAnimation {} | ||
|
|
||
| export class TypeInterface { | ||
| @functionDeclaration('duration: number, fps: number, drawer: (func: Curve) => Curve, func: (func: Curve) => Curve', 'AnimatedCurve') | ||
| animate_3D_curve() {} | ||
|
|
||
| @functionDeclaration('duration: number, fps: number, drawer: (func: Curve) => Curve, func: (func: Curve) => Curve', 'AnimatedCurve') | ||
| animate_curve() {} | ||
|
|
||
| @functionDeclaration('t: number', 'number') | ||
| arc() {} | ||
|
|
||
| @functionDeclaration('p: Point', 'number') | ||
| b_of() {} | ||
|
|
||
| @functionDeclaration('curve1: Curve, curve2: Curve', 'Curve') | ||
| connect_ends() {} | ||
|
|
||
| @functionDeclaration('curve1: Curve, curve2: Curve', 'Curve') | ||
| connect_rigidly() {} | ||
|
|
||
| @functionDeclaration('numPoints: number', '(func: Curve) => Curve') | ||
| draw_3D_connected() {} | ||
|
|
||
| @functionDeclaration('numPoints: number', '(func: Curve) => Curve') | ||
| draw_3D_connected_full_view() {} | ||
|
|
||
| @functionDeclaration('numPoints: number', '(func: Curve) => Curve') | ||
| draw_3D_connected_full_view_proportional() {} | ||
|
|
||
| @functionDeclaration('numPoints: number', '(func: Curve) => Curve') | ||
| draw_3D_points() {} | ||
|
|
||
| @functionDeclaration('numPoints: number', '(func: Curve) => Curve') | ||
| draw_3D_points_full_view() {} | ||
|
|
||
| @functionDeclaration('numPoints: number', '(func: Curve) => Curve') | ||
| draw_3D_points_full_view_proportional() {} | ||
|
|
||
| @functionDeclaration('numPoints: number', '(func: Curve) => Curve') | ||
| draw_connected() {} | ||
|
|
||
| @functionDeclaration('numPoints: number', '(func: Curve) => Curve') | ||
| draw_connected_full_view() {} | ||
|
|
||
| @functionDeclaration('numPoints: number', '(func: Curve) => Curve') | ||
| draw_connected_full_view_proportional() {} | ||
|
|
||
| @functionDeclaration('numPoints: number', '(func: Curve) => Curve') | ||
| draw_points() {} | ||
|
|
||
| @functionDeclaration('numPoints: number', '(func: Curve) => Curve') | ||
| draw_points_full_view() {} | ||
|
|
||
| @functionDeclaration('numPoints: number', '(func: Curve) => Curve') | ||
| draw_points_full_view_proportional() {} | ||
|
|
||
| @functionDeclaration('p: Point', 'number') | ||
| g_of() {} | ||
|
|
||
| @functionDeclaration('curve: Curve', 'Curve') | ||
| invert() {} | ||
|
|
||
| @functionDeclaration('x: number, y: number, z: number, r: number, g: number, b: number', 'Point') | ||
| make_3D_color_point() {} | ||
|
|
||
| @functionDeclaration('x: number, y: number, z: number', 'Point') | ||
| make_3D_point() {} | ||
|
|
||
| @functionDeclaration('x: number, y: number, r: number, g: number, b: number', 'Point') | ||
| make_color_point() {} | ||
|
|
||
| @functionDeclaration('x: number, y: number', 'Point') | ||
| make_point() {} | ||
|
|
||
| @functionDeclaration('curve: Curve', 'Curve') | ||
| put_in_standard_position() {} | ||
|
|
||
| @functionDeclaration('p: Point', 'number') | ||
| r_of() {} | ||
|
|
||
| @functionDeclaration('theta1: number, theta2: number, theta3: number', '(c: Curve) => Curve') | ||
| rotate_around_origin() {} | ||
|
|
||
| @functionDeclaration('x: number, y: number', '(c: Curve) => Curve') | ||
| scale() {} | ||
|
|
||
| @functionDeclaration('s: number', '(c: Curve) => Curve') | ||
| scale_proportional() {} | ||
|
|
||
| @functionDeclaration('x0: number, y0: number, z0: number', '(c: Curve) => Curve') | ||
| translate() {} | ||
|
|
||
| @functionDeclaration('t: number', 'Point') | ||
| unit_circle() {} | ||
|
|
||
| @functionDeclaration('t: number', 'Point') | ||
| unit_line() {} | ||
|
|
||
| @functionDeclaration('t: number', 'Curve') | ||
| unit_line_at() {} | ||
|
|
||
| @functionDeclaration('p: Point', 'number') | ||
| x_of() {} | ||
|
|
||
| @functionDeclaration('p: Point', 'number') | ||
| y_of() {} | ||
|
|
||
| @functionDeclaration('p: Point', 'number') | ||
| z_of() {} | ||
| } |
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
Oops, something went wrong.
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.