forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Add parsing for the "MetaProperty" `new.target`, which is a `MemberExpression`. We detect the `.` and create the `MetaPropertyNode` from that. Reviewed By: tmikov Differential Revision: D16421942 fbshipit-source-id: 9daf3151bbc04073c34f3a9cea7731e0f191b74e
- Loading branch information
1 parent
3cec787
commit c09c446
Showing
7 changed files
with
82 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,49 @@ | ||
// Copyright (c) Facebook, Inc. and its affiliates. | ||
// | ||
// This source code is licensed under the MIT license found in the LICENSE | ||
// file in the root directory of this source tree. | ||
// | ||
// RUN: %hermesc -dump-ast -pretty-json %s | %FileCheck %s --match-full-lines | ||
|
||
// CHECK: { | ||
// CHECK-NEXT: "type": "Program", | ||
// CHECK-NEXT: "body": [ | ||
|
||
function foo() { | ||
return new.target; | ||
} | ||
// CHECK-NEXT: { | ||
// CHECK-NEXT: "type": "FunctionDeclaration", | ||
// CHECK-NEXT: "id": { | ||
// CHECK-NEXT: "type": "Identifier", | ||
// CHECK-NEXT: "name": "foo", | ||
// CHECK-NEXT: "typeAnnotation": null | ||
// CHECK-NEXT: }, | ||
// CHECK-NEXT: "params": [], | ||
// CHECK-NEXT: "body": { | ||
// CHECK-NEXT: "type": "BlockStatement", | ||
// CHECK-NEXT: "body": [ | ||
// CHECK-NEXT: { | ||
// CHECK-NEXT: "type": "ReturnStatement", | ||
// CHECK-NEXT: "argument": { | ||
// CHECK-NEXT: "type": "MetaProperty", | ||
// CHECK-NEXT: "meta": { | ||
// CHECK-NEXT: "type": "Identifier", | ||
// CHECK-NEXT: "name": "new", | ||
// CHECK-NEXT: "typeAnnotation": null | ||
// CHECK-NEXT: }, | ||
// CHECK-NEXT: "property": { | ||
// CHECK-NEXT: "type": "Identifier", | ||
// CHECK-NEXT: "name": "target", | ||
// CHECK-NEXT: "typeAnnotation": null | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: ] | ||
// CHECK-NEXT: }, | ||
// CHECK-NEXT: "returnType": null, | ||
// CHECK-NEXT: "generator": false | ||
// CHECK-NEXT: } | ||
|
||
// CHECK-NEXT: ] | ||
// CHECK-NEXT: } |
This file contains 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