Closed Bug 880575 Opened 11 years ago Closed 11 years ago

Factor the JS shell's repl into a few functions

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: jorendorff, Assigned: jorendorff)

Details

Attachments

(5 files)

Who knows, maybe if the code is readable enough someone will take bug 480198. :)
This comes in five patches, all of them pretty trivial.
Assignee: general → jorendorff
Attachment #759597 - Flags: review?(jwalden+bmo)
Attachment #759598 - Flags: review?(jwalden+bmo)
Attachment #759599 - Flags: review?(jwalden+bmo)
Comment on attachment 759597 [details] [diff] [review]
Part 1 - Factor out ReadEvalPrintLoop, v1

Review of attachment 759597 [details] [diff] [review]:
-----------------------------------------------------------------

I don't care where the style nits get fixed in this patch stack, just fix them by the end.  :-)  I'm noting 'em as I see 'em.

::: js/src/shell/js.cpp
@@ +528,5 @@
>      free(buffer);
>      fprintf(gOutFile, "\n");
> +}
> +
> +class AutoCloseInputFile {

{ on new line.

@@ +533,5 @@
> +  private:
> +    FILE *f_;
> +  public:
> +    explicit AutoCloseInputFile(FILE *f) : f_(f) {}
> +    ~AutoCloseInputFile() { if (f_ && f_ != stdin) fclose(f_); }

I'd rather see this in multiple lines, honestly.

@@ +566,5 @@
> +         * hack, and gobble the first line if it starts with '#'.
> +         */
> +        int ch = fgetc(file);
> +        if (ch == '#') {
> +            while((ch = fgetc(file)) != EOF) {

Space after while.
Attachment #759597 - Flags: review?(jwalden+bmo) → review+
Attachment #759598 - Flags: review?(jwalden+bmo) → review+
Attachment #759599 - Flags: review?(jwalden+bmo) → review+
Attachment #759600 - Flags: review?(jwalden+bmo) → review+
Attachment #759601 - Flags: review?(jwalden+bmo) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: