Skip to content
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

Cd builtin #311

Merged
merged 14 commits into from
Jul 22, 2024
Merged

Cd builtin #311

merged 14 commits into from
Jul 22, 2024

Conversation

Mte90
Copy link
Member

@Mte90 Mte90 commented Jul 16, 2024

Following the new contributing guide I was able to add the cd builtin :-)

I updated the guide a bit to be more clear.

Ref: #215

@Mte90 Mte90 marked this pull request as ready for review July 16, 2024 13:33
@Mte90
Copy link
Member Author

Mte90 commented Jul 16, 2024

So in the ticket we are talking about making this builtin as failable but to be shellcheck validated we need to support the case that fails || exit.

How we can handle that behavior?

Copy link
Member

@Ph0enixKM Ph0enixKM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow! Good job @Mte90! I appreciate that modifications to the contributor guide 👏👏. Now if you want to make this failable, you have to add these 3 lines of code. Can you also add some information about it to the contributing guide?

src/modules/builtin/cd.rs Show resolved Hide resolved
src/modules/builtin/cd.rs Show resolved Hide resolved
src/modules/builtin/cd.rs Show resolved Hide resolved
@Mte90
Copy link
Member Author

Mte90 commented Jul 17, 2024

So now is failable but the test fails Failed expression must be followed by a block or statement.

I can't use unsafe before cd.

@MuhamedMagdi
Copy link
Contributor

I think we need also to add the cd keyword to the reserved keywords list in src/modules/variable/mod.rs
Ref: #318

@Mte90
Copy link
Member Author

Mte90 commented Jul 18, 2024

good catch @MuhamedMagdi I updated in this PR the contributing guide.

@Ph0enixKM
Copy link
Member

@Mte90 Can this PR stall until I change the API for TranslateModule? I'm talking about the solution that I proposed here: https://www.youtube.com/watch?v=_caXIMxrYj8

@Ph0enixKM
Copy link
Member

I'd say that this issue is stalled until this one is finished: #183

I'll do that one first so that we can move forward

@Mte90
Copy link
Member Author

Mte90 commented Jul 18, 2024

Sure the other one is more important

@Mte90 Mte90 mentioned this pull request Jul 19, 2024
CONTRIBUTING.md Show resolved Hide resolved
@b1ek
Copy link
Member

b1ek commented Jul 22, 2024

@Ph0enixKM please review again

b1ek
b1ek previously requested changes Jul 22, 2024
src/modules/statement/stmt.rs Show resolved Hide resolved
Copy link
Member

@KrosFire KrosFire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@Ph0enixKM Ph0enixKM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized that you should also use Command Modifier to give ability to use the unsafe (soon it will be assume) keyword here.

To parse the command modifier, you need to parse the command and self.failed in the command modifier context. Here is how it's done. You don't translate the command modifiers since they don't need to be translated.

Remember to use CommandModifier::new().parse_expr() instead of just CommandModifier::new() as the function will not make it look for expression (this should be simplified to CommandModifier::new() though. I'll fix it once you update this PR)

src/modules/builtin/cd.rs Outdated Show resolved Hide resolved
src/modules/builtin/cd.rs Show resolved Hide resolved
Co-authored-by: Phoenix Himself <[email protected]>
@Ph0enixKM
Copy link
Member

Okay @Mte90 let's remove the self.failed

@Mte90 Mte90 requested a review from Ph0enixKM July 22, 2024 16:05
Copy link
Member

@Ph0enixKM Ph0enixKM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Mte90 Mte90 dismissed b1ek’s stale review July 22, 2024 16:29

obsolete

@Mte90 Mte90 merged commit 571f77c into amber-lang:master Jul 22, 2024
1 check passed
@Mte90 Mte90 deleted the cd-builtin branch July 30, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants