< prev index next >

src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptEnvironment.java

Print this page




  44 /**
  45  * Script environment consists of command line options, arguments, script files
  46  * and output and error writers, top level Namespace etc.
  47  */
  48 public final class ScriptEnvironment {
  49     /** Output writer for this environment */
  50     private final PrintWriter out;
  51 
  52     /** Error writer for this environment */
  53     private final PrintWriter err;
  54 
  55     /** Top level namespace. */
  56     private final Namespace namespace;
  57 
  58     /** Current Options object. */
  59     private final Options options;
  60 
  61     /** Size of the per-global Class cache size */
  62     public final int     _class_cache_size;
  63 



  64     /** Only compile script, do not run it or generate other ScriptObjects */
  65     public final boolean _compile_only;
  66 
  67     /** Accept "const" keyword and treat it as variable. Interim feature */
  68     public final boolean _const_as_var;
  69 
  70     /** Accumulated callsite flags that will be used when bootstrapping script callsites */
  71     public final int     _callsite_flags;
  72 
  73     /** Generate line number table in class files */
  74     public final boolean _debug_lines;
  75 
  76     /** Directory in which source files and generated class files are dumped */
  77     public final String  _dest_dir;
  78 
  79     /** Display stack trace upon error, default is false */
  80     public final boolean _dump_on_error;
  81 
  82     /** Invalid lvalue expressions should be reported as early errors */
  83     public final boolean _early_lvalue_error;


 203     public final Map<String, LoggerInfo> _loggers;
 204 
 205     /** Timing */
 206     public final Timing _timing;
 207 
 208     /**
 209      * Constructor
 210      *
 211      * @param options a Options object
 212      * @param out output print writer
 213      * @param err error print writer
 214      */
 215     @SuppressWarnings("unused")
 216     public ScriptEnvironment(final Options options, final PrintWriter out, final PrintWriter err) {
 217         this.out = out;
 218         this.err = err;
 219         this.namespace = new Namespace();
 220         this.options = options;
 221 
 222         _class_cache_size     = options.getInteger("class.cache.size");

 223         _compile_only         = options.getBoolean("compile.only");
 224         _const_as_var         = options.getBoolean("const.as.var");
 225         _debug_lines          = options.getBoolean("debug.lines");
 226         _dest_dir             = options.getString("d");
 227         _dump_on_error        = options.getBoolean("doe");
 228         _early_lvalue_error   = options.getBoolean("early.lvalue.error");
 229         _empty_statements     = options.getBoolean("empty.statements");
 230         _fullversion          = options.getBoolean("fullversion");
 231         if (options.getBoolean("function.statement.error")) {
 232             _function_statement = FunctionStatementBehavior.ERROR;
 233         } else if (options.getBoolean("function.statement.warning")) {
 234             _function_statement = FunctionStatementBehavior.WARNING;
 235         } else {
 236             _function_statement = FunctionStatementBehavior.ACCEPT;
 237         }
 238         _fx                   = options.getBoolean("fx");
 239         _global_per_engine    = options.getBoolean("global.per.engine");
 240         _lazy_compilation     = options.getBoolean("lazy.compilation");
 241         _optimistic_types     = options.getBoolean("optimistic.types");
 242         _loader_per_compile   = options.getBoolean("loader.per.compile");




  44 /**
  45  * Script environment consists of command line options, arguments, script files
  46  * and output and error writers, top level Namespace etc.
  47  */
  48 public final class ScriptEnvironment {
  49     /** Output writer for this environment */
  50     private final PrintWriter out;
  51 
  52     /** Error writer for this environment */
  53     private final PrintWriter err;
  54 
  55     /** Top level namespace. */
  56     private final Namespace namespace;
  57 
  58     /** Current Options object. */
  59     private final Options options;
  60 
  61     /** Size of the per-global Class cache size */
  62     public final int     _class_cache_size;
  63 
  64     /** -classpath value. */
  65     public final String  _classpath;
  66 
  67     /** Only compile script, do not run it or generate other ScriptObjects */
  68     public final boolean _compile_only;
  69 
  70     /** Accept "const" keyword and treat it as variable. Interim feature */
  71     public final boolean _const_as_var;
  72 
  73     /** Accumulated callsite flags that will be used when bootstrapping script callsites */
  74     public final int     _callsite_flags;
  75 
  76     /** Generate line number table in class files */
  77     public final boolean _debug_lines;
  78 
  79     /** Directory in which source files and generated class files are dumped */
  80     public final String  _dest_dir;
  81 
  82     /** Display stack trace upon error, default is false */
  83     public final boolean _dump_on_error;
  84 
  85     /** Invalid lvalue expressions should be reported as early errors */
  86     public final boolean _early_lvalue_error;


 206     public final Map<String, LoggerInfo> _loggers;
 207 
 208     /** Timing */
 209     public final Timing _timing;
 210 
 211     /**
 212      * Constructor
 213      *
 214      * @param options a Options object
 215      * @param out output print writer
 216      * @param err error print writer
 217      */
 218     @SuppressWarnings("unused")
 219     public ScriptEnvironment(final Options options, final PrintWriter out, final PrintWriter err) {
 220         this.out = out;
 221         this.err = err;
 222         this.namespace = new Namespace();
 223         this.options = options;
 224 
 225         _class_cache_size     = options.getInteger("class.cache.size");
 226         _classpath            = options.getString("classpath");
 227         _compile_only         = options.getBoolean("compile.only");
 228         _const_as_var         = options.getBoolean("const.as.var");
 229         _debug_lines          = options.getBoolean("debug.lines");
 230         _dest_dir             = options.getString("d");
 231         _dump_on_error        = options.getBoolean("doe");
 232         _early_lvalue_error   = options.getBoolean("early.lvalue.error");
 233         _empty_statements     = options.getBoolean("empty.statements");
 234         _fullversion          = options.getBoolean("fullversion");
 235         if (options.getBoolean("function.statement.error")) {
 236             _function_statement = FunctionStatementBehavior.ERROR;
 237         } else if (options.getBoolean("function.statement.warning")) {
 238             _function_statement = FunctionStatementBehavior.WARNING;
 239         } else {
 240             _function_statement = FunctionStatementBehavior.ACCEPT;
 241         }
 242         _fx                   = options.getBoolean("fx");
 243         _global_per_engine    = options.getBoolean("global.per.engine");
 244         _lazy_compilation     = options.getBoolean("lazy.compilation");
 245         _optimistic_types     = options.getBoolean("optimistic.types");
 246         _loader_per_compile   = options.getBoolean("loader.per.compile");


< prev index next >