Closed Bug 883207 Opened 12 years ago Closed 12 years ago

Add Parser::pos()

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: jorendorff, Assigned: jorendorff)

Details

Attachments

(1 file, 1 obsolete file)

Precognitive followup to bug 872735 comment 11. tokenStream.currentToken().pos is such a common idiom in the Parser that a convenience function is kind of nice. (I found one use of the idiom that is actually totally unnecessary, in the amazingly twisty Parser::forStatement(). We have an assignment to forHead->pn_pos, and then a few lines later both fields are overwritten. D'oh.)
Attached patch v1 (obsolete) — Splinter Review
Attachment #762741 - Flags: review?(jwalden+bmo)
Assignee: general → jorendorff
Attached patch v2Splinter Review
Just like v1, but eliminate unnecessary 'uint32_t end = pos().end;' in a few places where the temporary 'end' isn't needed anymore to avoid splitting lines.
Attachment #762741 - Attachment is obsolete: true
Attachment #762741 - Flags: review?(jwalden+bmo)
Attachment #762780 - Flags: review?(jwalden+bmo)
Comment on attachment 762780 [details] [diff] [review] v2 Review of attachment 762780 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/frontend/Parser.cpp @@ +4702,4 @@ > RootedPropertyName label(context); > if (!MatchLabel(context, &tokenStream, &label)) > return null(); > + pn = handler.newContinue(label, begin, pos().end); I'd kind of prefer methods take TokenPos arguments (or const&) rather than begin/end separately -- and there are some methods in here which do this already -- but that's not an immediate concern to fix here.
Attachment #762780 - Flags: review?(jwalden+bmo) → review+
OK, I agree. We'll fix it in bug 883333.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: