@@ -18,8 +18,9 @@ const createEmptyRuntime = () => ({
1818 nodes : [ ]
1919} )
2020
21- export const createEmptyContext = < T > ( chapter : number , externalContext ?: T ) : Context < T > => ( {
21+ export const createEmptyContext = < T > ( chapter : number , externalSymbols : string [ ] , externalContext ?: T ) : Context < T > => ( {
2222 chapter,
23+ externalSymbols,
2324 errors : [ ] ,
2425 externalContext,
2526 cfg : createEmptyCFG ( ) ,
@@ -47,10 +48,10 @@ const defineSymbol = (context: Context, name: string, value: Value) => {
4748 globalFrame . environment [ name ] = value
4849}
4950
50- export const importExternals = ( context : Context , externals : string [ ] ) => {
51+ export const importExternalSymbols = ( context : Context , externalSymbols : string [ ] ) => {
5152 ensureGlobalEnvironmentExist ( context )
5253
53- externals . forEach ( symbol => {
54+ externalSymbols . forEach ( symbol => {
5455 defineSymbol ( context , symbol , GLOBAL [ symbol ] )
5556 } )
5657}
@@ -154,12 +155,12 @@ const defaultBuiltIns: CustomBuiltIns = {
154155 throw new Error ( 'List visualizer is not enabled' ) }
155156}
156157
157- const createContext = < T > ( chapter = 1 , externals : string [ ] = [ ] , externalContext ?: T ,
158+ const createContext = < T > ( chapter = 1 , externalSymbols : string [ ] = [ ] , externalContext ?: T ,
158159 externalBuiltIns : CustomBuiltIns = defaultBuiltIns ) => {
159- const context = createEmptyContext ( chapter , externalContext )
160+ const context = createEmptyContext ( chapter , externalSymbols , externalContext )
160161
161162 importBuiltins ( context , externalBuiltIns )
162- importExternals ( context , externals )
163+ importExternalSymbols ( context , externalSymbols )
163164
164165 return context
165166}
0 commit comments