File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -298,7 +298,8 @@ private bool AllowNewDotTarget()
298298 {
299299 // https://github.com/acornjs/acorn/blob/8.11.3/acorn/src/state.js > `get allowNewDotTarget`
300300
301- return ( CurrentThisScope ( out _ ) . Flags & ( ScopeFlags . Function | ScopeFlags . ClassStaticBlock | ScopeFlags . InClassFieldInit ) ) != 0 ;
301+ return _options. AllowNewTargetOutsideFunction
302+ || ( CurrentThisScope ( out _ ) . Flags & ( ScopeFlags . Function | ScopeFlags . ClassStaticBlock | ScopeFlags . InClassFieldInit ) ) != 0 ;
302303 }
303304
304305 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
Original file line number Diff line number Diff line change @@ -87,6 +87,13 @@ public EcmaVersion EcmaVersion
8787 /// </remarks>
8888 public bool AllowAwaitOutsideFunction { get => _allowAwaitOutsideFunction ; init => _allowAwaitOutsideFunction = value ; }
8989
90+ internal readonly bool _allowNewTargetOutsideFunction ;
91+ /// <summary>
92+ /// Gets or sets whether to allow new.target meta-properties in the top-level scope.
93+ /// Defaults to <see langword="false"/>.
94+ /// </summary>
95+ public bool AllowNewTargetOutsideFunction { get => _allowNewTargetOutsideFunction ; init => _allowNewTargetOutsideFunction = value ; }
96+
9097 internal readonly bool _allowSuperOutsideMethod ;
9198 /// <summary>
9299 /// Gets or sets whether to allow super identifiers to appear outside methods.
You can’t perform that action at this time.
0 commit comments