This commit is contained in:
Dmitry Vasilev
2022-12-25 16:39:20 +08:00
parent 6fbe67e7f0
commit 5b8a6526f6
2 changed files with 8 additions and 11 deletions

View File

@@ -14,9 +14,6 @@ import {
import {has_toplevel_await} from './find_definitions.js'
// external
import {patch_promise} from './patch_promise.js'
// TODO: fix error messages. For example, "__fn is not a function"
/*
@@ -399,12 +396,7 @@ export const eval_modules = (
}
const set_promise_status = value => {
// TODO refactor, put is_status_requested inside status
if(value instanceof Promise) {
if(value.is_status_requested) {
return value
}
value.is_status_requested = true
// record stack for async calls, so expand calls works sync
set_record_call()
// TODO why we set status for wrapped value and not for wrapper?
@@ -431,8 +423,7 @@ export const eval_modules = (
children = []
}
const children_copy = children
if(value instanceof Promise && !value.is_status_requested) {
value.is_status_requested = true
if(value instanceof Promise) {
value.then(
v => {
value.status = {ok: true, value: v}

View File

@@ -45,6 +45,7 @@ const adjust_path = path => {
)
}
/*
const load_external_modules = async state => {
const urls = state.loading_external_imports_state.external_imports
const results = await Promise.all(
@@ -62,6 +63,7 @@ const load_external_modules = async state => {
))
)
}
*/
const dir = load_dir('.')
@@ -71,10 +73,14 @@ const i = test_initial_state(
{}, // files
{project_dir: dir, entrypoint: 'test/run.js'}
)
assert_equal(i.loading_external_imports_state != null, true)
/*
assert_equal(i.loading_external_imports_state != null, true)
const external_imports = await load_external_modules(i)
const loaded = COMMANDS.external_imports_loaded(i, i, external_imports)
*/
const loaded = i
assert_equal(loaded.eval_modules_state != null, true)
const s = loaded.eval_modules_state