Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
1378304
javascript back converter
jogibear9988 Nov 2, 2021
fbf1cad
fix coding to match esprima-net style
jogibear9988 Nov 4, 2021
294cd2d
fixes after code review
jogibear9988 Nov 4, 2021
0cefdb6
work on ToJavascriptTest and Beautification
jogibear9988 Nov 9, 2021
f9a1029
more tests, nicer code
jogibear9988 Nov 9, 2021
91727b1
bugfix rest of tests
jogibear9988 Nov 9, 2021
d1d84e4
bugfx test, add newline type
jogibear9988 Nov 10, 2021
ca68863
bugfix function expression
jogibear9988 Nov 10, 2021
d2eb4dd
more beautification
jogibear9988 Nov 10, 2021
c038d7a
fixes after rebase
jogibear9988 Jul 4, 2022
b0f4387
Rename ToJavascriptConverter to AstToJavascriptConverter
adams85 Jul 6, 2022
b749cb8
revise design of AstJson/AstToJsonConverter and align AstToJavascript…
adams85 Jul 6, 2022
c887231
inherit from AstVisitor, eliminate ParentStack
adams85 Jul 6, 2022
0ea888a
complete rework of code formatting and parenthesis handling + fix a t…
adams85 Jul 7, 2022
4eed8ac
fix existing tests + implement comprehensive testing
adams85 Jul 17, 2022
5a8088c
implement Node.ToString + define debugger display
adams85 Jul 18, 2022
358b7ce
improve code organization, sort VisitXXX methods alphabetically
adams85 Jul 18, 2022
0d073ee
remove regions
adams85 Jul 19, 2022
05667a3
revise throw usage in inlined methods
adams85 Jul 19, 2022
5912c0b
fix 'in' operator bracketing bug in for loop variable declarations
adams85 Jul 19, 2022
5e573c9
fix indentation bug in KnRJavascriptTextWriter + add Data field to Wr…
adams85 Jul 19, 2022
dc1c492
rename AstJson to AstToJson for consistency
adams85 Jul 20, 2022
fe28071
improve public API
adams85 Jul 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

<ItemGroup>
<Compile Include="..\Shared\Compatibility\IsExternalInit.cs" Link="Compatibility\IsExternalInit.cs" />
<Compile Include="..\Shared\Compatibility\NullableAttributes.cs" Link="Compatibility\NullableAttributes.cs" />
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions src/Esprima/Ast/ArrayExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public ArrayExpression(in NodeList<Expression?> elements) : base(Nodes.ArrayExpr
_elements = elements;
}

/// <summary>
/// { <see cref="Expression"/> (incl. <see cref="SpreadElement"/>) | <see langword="null"/> }
/// </summary>
public ref readonly NodeList<Expression?> Elements { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref _elements; }

internal override Node? NextChildNode(ref ChildNodes.Enumerator enumerator) => enumerator.MoveNextNullable(Elements);
Expand Down
3 changes: 3 additions & 0 deletions src/Esprima/Ast/ArrayPattern.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public ArrayPattern(in NodeList<Expression?> elements) : base(Nodes.ArrayPattern
_elements = elements;
}

/// <summary>
/// { <see cref="Identifier"/> | <see cref="BindingPattern"/> | <see cref="AssignmentPattern"/> | <see cref="RestElement"/> | <see langword="null"/> }
/// </summary>
public ref readonly NodeList<Expression?> Elements { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref _elements; }

internal override Node? NextChildNode(ref ChildNodes.Enumerator enumerator) => enumerator.MoveNextNullable(Elements);
Expand Down
5 changes: 4 additions & 1 deletion src/Esprima/Ast/ArrowFunctionExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ public ArrowFunctionExpression(
}

Identifier? IFunction.Id => null;
/// <summary>
/// { <see cref="Identifier"/> | <see cref="BindingPattern"/> | <see cref="AssignmentPattern"/> | <see cref="RestElement"/> }
/// </summary>
public ref readonly NodeList<Expression> Params { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref _params; }
/// <remarks>
/// <see cref="BlockStatement" /> | <see cref="Ast.Expression" />
/// <see cref="BlockStatement"/> | <see cref="Ast.Expression"/>
/// </remarks>
public Node Body { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
bool IFunction.Generator => false;
Expand Down
3 changes: 2 additions & 1 deletion src/Esprima/Ast/AssignmentExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ public static string GetAssignmentOperatorToken(AssignmentOperator op)
}

public AssignmentOperator Operator { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }

/// <remarks>
/// Can be something else than Expression (<see cref="ObjectPattern"/>, <see cref="ArrayPattern"/>) in case of destructuring assignment
/// <see cref="Identifier"/> | <see cref="BindingPattern"/>
/// </remarks>
public Expression Left { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
public Expression Right { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
Expand Down
3 changes: 3 additions & 0 deletions src/Esprima/Ast/AssignmentPattern.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ public AssignmentPattern(Expression left, Expression right) : base(Nodes.Assignm
_right = right;
}

/// <summary>
/// <see cref="Identifier"/> | <see cref="BindingPattern"/>
/// </summary>
public Expression Left { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
public Expression Right { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => _right; }

Expand Down
2 changes: 1 addition & 1 deletion src/Esprima/Ast/CatchClause.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public CatchClause(Expression? param, BlockStatement body) :
}

/// <remarks>
/// BindingIdentifier | <see cref="BindingPattern"/> | <see langword="null"/>
/// <see cref="Identifier"/> | <see cref="BindingPattern"/>
/// </remarks>
public Expression? Param { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
public BlockStatement Body { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
Expand Down
2 changes: 1 addition & 1 deletion src/Esprima/Ast/ChainExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public ChainExpression(Expression expression) : base(Nodes.ChainExpression)
}

/// <remarks>
/// <see cref="CallExpression" /> | <see cref="ComputedMemberExpression" />| <see cref="StaticMemberExpression" />
/// <see cref="CallExpression"/> | <see cref="ComputedMemberExpression"/>| <see cref="StaticMemberExpression"/>
/// </remarks>
public Expression Expression { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }

Expand Down
2 changes: 1 addition & 1 deletion src/Esprima/Ast/ClassBody.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public ClassBody(in NodeList<ClassElement> body) : base(Nodes.ClassBody)
}

/// <remarks>
/// <see cref="MethodDefinition" /> | <see cref="PropertyDefinition" /> | <see cref="StaticBlock" />
/// <see cref="MethodDefinition"/> | <see cref="PropertyDefinition"/> | <see cref="StaticBlock"/>
/// </remarks>
public ref readonly NodeList<ClassElement> Body { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref _body; }

Expand Down
2 changes: 1 addition & 1 deletion src/Esprima/Ast/ClassDeclaration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public ClassDeclaration(Identifier? id, Expression? superClass, ClassBody body,

public Identifier? Id { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
/// <remarks>
/// <see cref="Identifier" /> | <see cref="CallExpression" />
/// <see cref="Identifier"/> | <see cref="CallExpression"/>
/// </remarks>
public Expression? SuperClass { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
public ClassBody Body { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
Expand Down
2 changes: 1 addition & 1 deletion src/Esprima/Ast/ClassExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public ClassExpression(

public Identifier? Id { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
/// <remarks>
/// <see cref="Identifier" /> | <see cref="CallExpression" />
/// <see cref="Identifier"/> | <see cref="CallExpression"/>
/// </remarks>
public Expression? SuperClass { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
public ClassBody Body { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
Expand Down
2 changes: 1 addition & 1 deletion src/Esprima/Ast/ClassProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ protected ClassProperty(Nodes type, PropertyKind kind, Expression key, bool comp

public PropertyKind Kind { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
/// <remarks>
/// <see cref="Identifier"/> | <see cref="Literal"/> | '[' <see cref="Expression"/> ']'
/// <see cref="Identifier"/> | <see cref="Literal"/> (string or numeric) | '[' <see cref="Expression"/> ']' | <see cref="PrivateIdentifier"/>
/// </remarks>
public Expression Key { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
public bool Computed { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
Expand Down
2 changes: 1 addition & 1 deletion src/Esprima/Ast/ExportAllDeclaration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public ExportAllDeclaration(Literal source, Expression? exported, in NodeList<Im

public Literal Source { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
/// <remarks>
/// <see cref="Identifier" /> | StringLiteral (<see cref="Literal" />)
/// <see cref="Identifier"/> | <see cref="Literal"/> (string)
/// </remarks>
public Expression? Exported { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
public ref readonly NodeList<ImportAttribute> Assertions { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref _assertions; }
Expand Down
2 changes: 1 addition & 1 deletion src/Esprima/Ast/ExportDefaultDeclaration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public ExportDefaultDeclaration(StatementListItem declaration) : base(Nodes.Expo
}

/// <remarks>
/// BindingIdentifier | <see cref="BindingPattern" /> | <see cref="ClassDeclaration" /> | <see cref="Expression" /> | <see cref="FunctionDeclaration" />
/// <see cref="Expression"/> | <see cref="ClassDeclaration"/> | <see cref="FunctionDeclaration"/>
/// </remarks>
public StatementListItem Declaration { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }

Expand Down
3 changes: 3 additions & 0 deletions src/Esprima/Ast/ExportNamedDeclaration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public ExportNamedDeclaration(
_assertions = assertions;
}

/// <remarks>
/// <see cref="VariableDeclaration"/> | <see cref="ClassDeclaration"/> | <see cref="FunctionDeclaration"/>
/// </remarks>
public StatementListItem? Declaration { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
public ref readonly NodeList<ExportSpecifier> Specifiers { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref _specifiers; }
public Literal? Source { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
Expand Down
4 changes: 2 additions & 2 deletions src/Esprima/Ast/ExportSpecifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ public ExportSpecifier(Expression local, Expression exported) : base(Nodes.Expor
}

/// <remarks>
/// <see cref="Identifier" /> | StringLiteral (<see cref="Literal" />)
/// <see cref="Identifier"/> | <see cref="Literal"/> (string)
/// </remarks>
public Expression Local { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
/// <remarks>
/// <see cref="Identifier" /> | <see cref="Literal" />
/// <see cref="Identifier"/> | <see cref="Literal"/> (string)
/// </remarks>
public Expression Exported { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }

Expand Down
3 changes: 3 additions & 0 deletions src/Esprima/Ast/ForInStatement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public ForInStatement(
Body = body;
}

/// <remarks>
/// <see cref="VariableDeclaration"/> (may have an initializer in non-strict mode) | <see cref="Identifier"/> | <see cref="BindingPattern"/>
/// </remarks>
public Node Left { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
public Expression Right { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
public Statement Body { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
Expand Down
3 changes: 3 additions & 0 deletions src/Esprima/Ast/ForOfStatement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public ForOfStatement(
Await = await;
}

/// <remarks>
/// <see cref="VariableDeclaration"/> (cannot have an initializer) | <see cref="Identifier"/> | <see cref="BindingPattern"/>
/// </remarks>
public Node Left { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
public Expression Right { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
public Statement Body { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
Expand Down
2 changes: 1 addition & 1 deletion src/Esprima/Ast/ForStatement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public ForStatement(
}

/// <remarks>
/// <see cref="Statement"/> (var i) | <see cref="Expression"/> (i=0)
/// <see cref="VariableDeclaration"/> (var i) | <see cref="Expression"/> (i=0)
/// </remarks>
public StatementListItem? Init { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
public Expression? Test { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
Expand Down
3 changes: 3 additions & 0 deletions src/Esprima/Ast/FunctionDeclaration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public FunctionDeclaration(
}

public Identifier? Id { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
/// <summary>
/// { <see cref="Identifier"/> | <see cref="BindingPattern"/> | <see cref="AssignmentPattern"/> | <see cref="RestElement"/> }
/// </summary>
public ref readonly NodeList<Expression> Params { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref _params; }

public BlockStatement Body { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
Expand Down
3 changes: 3 additions & 0 deletions src/Esprima/Ast/FunctionExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public FunctionExpression(
}

public Identifier? Id { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
/// <summary>
/// { <see cref="Identifier"/> | <see cref="BindingPattern"/> | <see cref="AssignmentPattern"/> | <see cref="RestElement"/> }
/// </summary>
public ref readonly NodeList<Expression> Params { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref _params; }

public BlockStatement Body { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
Expand Down
1 change: 1 addition & 0 deletions src/Esprima/Ast/IClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/// </summary>
public interface IClass
{
Nodes Type { get; }
Identifier? Id { get; }
Expression? SuperClass { get; }
ClassBody Body { get; }
Expand Down
1 change: 1 addition & 0 deletions src/Esprima/Ast/IFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/// </summary>
public interface IFunction
{
Nodes Type { get; }
Identifier? Id { get; }
ref readonly NodeList<Expression> Params { get; }
Node Body { get; }
Expand Down
1 change: 1 addition & 0 deletions src/Esprima/Ast/IProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
public interface IProperty
{
Nodes Type { get; }
PropertyKind Kind { get; }
Expression Key { get; }
bool Computed { get; }
Expand Down
4 changes: 1 addition & 3 deletions src/Esprima/Ast/Identifier.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.CompilerServices;
using Esprima.Utils;

namespace Esprima.Ast
{
[DebuggerDisplay("{Name,nq}")]
public sealed class Identifier : Expression
{
public Identifier(string? name) : base(Nodes.Identifier)
Expand Down
2 changes: 1 addition & 1 deletion src/Esprima/Ast/ImportAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public ImportAttribute(Expression key, Literal value) : base(Nodes.ImportAttribu
}

/// <remarks>
/// <see cref="Identifier" /> | <see cref="Literal" />
/// <see cref="Identifier"/> | <see cref="Literal"/>
/// </remarks>
public Expression Key { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
public Literal Value { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
Expand Down
2 changes: 1 addition & 1 deletion src/Esprima/Ast/ImportSpecifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public ImportSpecifier(Identifier local, Expression imported) : base(local, Node
}

/// <remarks>
/// <see cref="Identifier" /> | StringLiteral (<see cref="Literal" />)
/// <see cref="Identifier"/> | <see cref="Literal"/> (string)
/// </remarks>
public Expression Imported { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }

Expand Down
4 changes: 1 addition & 3 deletions src/Esprima/Ast/Literal.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using System.Diagnostics;
using System.Numerics;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using Esprima.Utils;

namespace Esprima.Ast
{
[DebuggerDisplay("{Raw,nq}")]
public sealed class Literal : Expression
{
internal Literal(TokenType tokenType, object? value, string raw) : base(Nodes.Literal)
Expand Down
11 changes: 10 additions & 1 deletion src/Esprima/Ast/Node.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System.Runtime.CompilerServices;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using Esprima.Utils;

namespace Esprima.Ast
{
[DebuggerDisplay($"{{{nameof(GetDebuggerDisplay)}(), nq}}")]
public abstract class Node
{
protected Node(Nodes type)
Expand Down Expand Up @@ -43,5 +45,12 @@ protected Node(Nodes type)
{
return visitor.VisitExtension(this);
}

public override string ToString() => this.ToJavascriptString(beautify: true);

private string GetDebuggerDisplay()
{
return $"/*{Type}*/ {this}";
}
}
}
2 changes: 2 additions & 0 deletions src/Esprima/Ast/NodeExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics;
using System.Runtime.CompilerServices;
using static Esprima.EsprimaExceptionHelper;
using NodeSysList = System.Collections.Generic.List<Esprima.Ast.Node>;

Expand All @@ -7,6 +8,7 @@ namespace Esprima.Ast
public static class NodeExtensions
{
[DebuggerStepThrough]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static T As<T>(this Node node) where T : Node
{
return (T) node;
Expand Down
8 changes: 8 additions & 0 deletions src/Esprima/Ast/NodeList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,18 @@ public int Count
get => _count;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public NodeList<Node?> AsNodes()
{
return new NodeList<Node?>(_items /* conversion by co-variance! */, _count);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public NodeList<TTo> As<TTo>() where TTo : Node?
{
return new NodeList<TTo>((TTo[]?) (object?) _items, _count);
}

public T this[int index]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down Expand Up @@ -203,6 +210,7 @@ var count
}
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static bool AreSame<T>(in NodeList<T> nodeList1, in NodeList<T> nodeList2) where T : Node?
{
return nodeList1._items == nodeList2._items;
Expand Down
3 changes: 3 additions & 0 deletions src/Esprima/Ast/ObjectExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public ObjectExpression(in NodeList<Expression> properties) : base(Nodes.ObjectE
_properties = properties;
}

/// <summary>
/// { <see cref="Property"/> | <see cref="SpreadElement"/> }
/// </summary>
public ref readonly NodeList<Expression> Properties { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref _properties; }

internal override Node? NextChildNode(ref ChildNodes.Enumerator enumerator) => enumerator.MoveNext(Properties);
Expand Down
3 changes: 3 additions & 0 deletions src/Esprima/Ast/ObjectPattern.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public ObjectPattern(in NodeList<Node> properties) : base(Nodes.ObjectPattern)
_properties = properties;
}

/// <summary>
/// { <see cref="Property"/> | <see cref="RestElement"/> }
/// </summary>
public ref readonly NodeList<Node> Properties { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref _properties; }

internal override Node? NextChildNode(ref ChildNodes.Enumerator enumerator) => enumerator.MoveNext(Properties);
Expand Down
6 changes: 5 additions & 1 deletion src/Esprima/Ast/Property.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ public Property(

public PropertyKind Kind { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
/// <remarks>
/// <see cref="Identifier"/> | <see cref="Literal"/> | '[' <see cref="Expression"/> ']'
/// <see cref="Identifier"/> | <see cref="Literal"/> (string or numeric) | '[' <see cref="Expression"/> ']'
/// </remarks>
public Expression Key { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }
public bool Computed { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }

/// <remarks>
/// When property of an object literal: <see cref="Expression"/> (incl. <see cref="SpreadElement"/> and <see cref="FunctionExpression"/> for getters/setters/methods) <br />
/// When property of an object binding pattern: <see cref="Identifier"/> | <see cref="BindingPattern"/> | <see cref="AssignmentPattern"/> | <see cref="RestElement"/>
/// </remarks>
public Expression Value { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => _value; }
Expression? IProperty.Value => Value;

Expand Down
2 changes: 1 addition & 1 deletion src/Esprima/Ast/RestElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public RestElement(Expression argument) : base(Nodes.RestElement)
}

/// <remarks>
/// BindingIdentifier | <see cref="BindingPattern"/>
/// <see cref="Identifier"/> | <see cref="BindingPattern"/>
/// </remarks>
public Expression Argument { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; }

Expand Down
Loading