Skip to content

Commit c3a1509

Browse files
authored
Merge pull request #138 from amigrave/fix-readfile-default-option
fix parser's readfile default option value
2 parents ef3c03d + f30dd00 commit c3a1509

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/rapydscript.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -4611,7 +4611,8 @@ var ՐՏ_modules = {};
46114611
dropDecorators: [],
46124612
dropImports: [],
46134613
dropDocstrings: false,
4614-
classes: null
4614+
classes: null,
4615+
readfile: require("fs").readFileSync
46154616
});
46164617
module_id = options.module_id;
46174618
import_dirs = options.import_dirs.slice(0);
@@ -5180,7 +5181,7 @@ var ՐՏ_modules = {};
51805181
contents = parse(src_code, {
51815182
filename: filename,
51825183
toplevel: null,
5183-
readfile: options.readfile || require("fs").readFileSync,
5184+
readfile: options.readfile,
51845185
basedir: options.basedir,
51855186
libdir: options.libdir,
51865187
module_id: key,

src/parser.pyj

+3-2
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ def parse($TEXT, options):
249249
dropDecorators: [], # Decorators to omit from compilation
250250
dropImports: [], # Imports to omit from compilation
251251
dropDocstrings: False, # If true, omit docstrings from compilation
252-
classes: None # Map of class names to ast.Class that are available in the global namespace (used by the REPL)
252+
classes: None, # Map of class names to ast.Class that are available in the global namespace (used by the REPL)
253+
readfile: require('fs').readFileSync, # File reader
253254
})
254255
module_id = options.module_id
255256

@@ -787,7 +788,7 @@ def parse($TEXT, options):
787788
contents = parse(src_code, {
788789
filename: filename,
789790
toplevel: None,
790-
readfile: options.readfile or require('fs').readFileSync,
791+
readfile: options.readfile,
791792
basedir: options.basedir,
792793
libdir: options.libdir,
793794
module_id: key,

0 commit comments

Comments
 (0)