33using System . Linq ;
44using System . Reflection ;
55using Jint . Native ;
6+ using Jint . Native . Function ;
67using Jint . Native . Object ;
78using Jint . Runtime ;
89using Jint . Runtime . Interop ;
@@ -47,7 +48,7 @@ public class Options
4748 /// <summary>
4849 /// Host options.
4950 /// </summary>
50- internal HostOptions Host { get ; } = new ( ) ;
51+ public HostOptions Host { get ; } = new ( ) ;
5152
5253 /// <summary>
5354 /// Module options
@@ -64,7 +65,6 @@ public class Options
6465 /// </summary>
6566 public CultureInfo Culture { get ; set ; } = _defaultCulture ;
6667
67-
6868 /// <summary>
6969 /// Configures a time system to use. Defaults to DefaultTimeSystem using local time.
7070 /// </summary>
@@ -94,7 +94,12 @@ public ITimeSystem TimeSystem
9494 /// <remarks>
9595 /// https://tc39.es/ecma262/#sec-hostensurecancompilestrings
9696 /// </remarks>
97- public bool StringCompilationAllowed { get ; set ; } = true ;
97+ [ Obsolete ( "Use Options.Host.StringCompilationAllowed" ) ]
98+ public bool StringCompilationAllowed
99+ {
100+ get => Host . StringCompilationAllowed ;
101+ set => Host . StringCompilationAllowed = value ;
102+ }
98103
99104 /// <summary>
100105 /// Options for the built-in JSON (de)serializer which
@@ -436,6 +441,21 @@ public class ConstraintOptions
436441 public class HostOptions
437442 {
438443 internal Func < Engine , Host > Factory { get ; set ; } = _ => new Host ( ) ;
444+
445+ /// <summary>
446+ /// Whether calling 'eval' with custom code and function constructors taking function code as string is allowed.
447+ /// Defaults to true.
448+ /// </summary>
449+ /// <remarks>
450+ /// https://tc39.es/ecma262/#sec-hostensurecancompilestrings
451+ /// </remarks>
452+ public bool StringCompilationAllowed { get ; set ; } = true ;
453+
454+ /// <summary>
455+ /// Possibility to override Jint's default function() { [native code] } format for functions using AST Node.
456+ /// If callback return null, Jint will use its own default logic.
457+ /// </summary>
458+ public Func < Function , Node , string ? > FunctionToStringHandler { get ; set ; } = ( _ , _ ) => null ;
439459 }
440460
441461 /// <summary>
0 commit comments