-
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add import attributes feature (#381)
* Revert "Remove import assertions feature (#377)" This reverts commit 695825c. * Apply syntax ("with" keyword instead of "assert") and ESTree naming changes ("Attributes" properties instead of "Assertions") * Fix tests
- Loading branch information
Showing
28 changed files
with
921 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System.Runtime.CompilerServices; | ||
|
||
namespace Esprima.Ast; | ||
|
||
[VisitableNode(ChildProperties = new[] { nameof(Key), nameof(Value) })] | ||
public sealed partial class ImportAttribute : Node | ||
{ | ||
public ImportAttribute(Expression key, Literal value) : base(Nodes.ImportAttribute) | ||
{ | ||
Key = key; | ||
Value = value; | ||
} | ||
|
||
/// <remarks> | ||
/// <see cref="Identifier"/> | <see cref="Literal"/> (string or numeric) | ||
/// </remarks> | ||
public Expression Key { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; } | ||
public Literal Value { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; } | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
private ImportAttribute Rewrite(Expression key, Literal value) | ||
{ | ||
return new ImportAttribute(key, value); | ||
} | ||
} |
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
Oops, something went wrong.