Status

()

enhancement
P3
normal
RESOLVED FIXED
8 months ago
7 months ago

People

(Reporter: arai, Assigned: arai)

Tracking

Trunk
mozilla64
Points:
---

Firefox Tracking Flags

(firefox64 fixed)

Details

Attachments

(1 attachment)

Assignee

Description

8 months ago
ParseNode::name is valid only for ParseNodeKind::Function and ParseNodeKind::Name.
we should move the method to CodeNode and NameNode, and use appropriate subclasses in the callsites.
Assignee

Comment 2

8 months ago
actually, ParseNodeKind::Function case is not used.
Assignee

Comment 3

8 months ago
moved ParseNode::name to NameNode::name and removed PNK::Function case.
also removed ParseNode-inl.h since now it's empty.
Attachment #9016535 - Flags: review?(jorendorff)
Comment on attachment 9016535 [details] [diff] [review]
Remove ParseNode::name.

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

Thank you!

::: js/src/frontend/BytecodeEmitter.cpp
@@ +6547,5 @@
>      ParseNode* funNode = argsList->head();
>      if (constructing) {
>          callOp = JSOP_NEW;
>      } else if (funNode->getKind() == ParseNodeKind::Name &&
> +               funNode->as<NameNode>().name() == cx->names().std_Function_apply) {

This idiom seems to come up pretty often. Is it worth having a method for this, like:

    funNode->isName(cx->names().std_Function_apply)

?

@@ +6741,5 @@
>      return emitElemOpBase(JSOP_GETELEM_SUPER);
>  }
>  
>  bool
> +BytecodeEmitter::isRestParameter(ParseNode* maybeRest)

Please don't rename this to `maybeRest`. To me, `maybe` suggests that the value can be null.

I think `pn` is fine here. `expr` would be OK too, indicating that the node passed to this function is always an expression, not a statement or something else.

::: js/src/wasm/AsmJS.cpp
@@ +3114,5 @@
>      if (!var->isKind(ParseNodeKind::Name)) {
>          return m.fail(var, "import variable is not a plain name");
>      }
>  
> +    auto varName = var->as<NameNode>().name();

Please don't use `auto` for this in particular, as it's not immediately obvious that this is a PropertyName* (as opposed to a JSAtom* or some other string type).
Attachment #9016535 - Flags: review?(jorendorff) → review+

Comment 6

7 months ago
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/847c7c6af1db
Remove ParseNode::name. r=jorendorff

Comment 7

7 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/847c7c6af1db
Status: ASSIGNED → RESOLVED
Last Resolved: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in before you can comment on or make changes to this bug.