Skip to content

unit-doc-02.API-REFERENCE20.exe failed #5191

Open
@lygstate

Description

@lygstate
JerryScript revision

c509a06

#include <jerryscript.h>

static jerry_value_t
module_resolve_callback (const jerry_value_t specifier,
                         const jerry_value_t referrer,
                         void *user_data_p)
{
  /* In this case, the specifier contains 'b.mjs', and the referrer is the module
   * created in the main() function below. Normally the specifier string should be
   * extended to a full file system path, and it should be checked whether a module
   * corresponding to this path has been loaded already. For simplicity, this function
   * returns with a new module. */

  const jerry_char_t script[] = "export var a = 5";

  jerry_parse_options_t parse_options;
  parse_options.options = JERRY_PARSE_MODULE | JERRY_PARSE_HAS_SOURCE_NAME;
  parse_options.source_name = jerry_string_sz ("b.mjs");

  jerry_value_t result = jerry_parse (script, sizeof (script) - 1, &parse_options);
  jerry_value_free (parse_options.source_name);
  return result;
} /* module_resolve_callback */

int
main (void)
{
  jerry_init (JERRY_INIT_EMPTY);

  const jerry_char_t script[] = "import a from 'b.mjs'";

  jerry_parse_options_t parse_options;
  parse_options.options = JERRY_PARSE_MODULE | JERRY_PARSE_HAS_SOURCE_NAME;
  parse_options.source_name = jerry_string_sz ("a.mjs");

  jerry_value_t ret_value = jerry_parse (script, sizeof (script) - 1, &parse_options);
  jerry_value_free (parse_options.source_name);

  jerry_module_link (ret_value, module_resolve_callback, NULL);

  jerry_value_free (ret_value);

  jerry_cleanup ();
  return 0;

fail with:

ucrtbased.dll!00007ffc1f2b48d5() (Unknown Source:0)
ucrtbased.dll!00007ffc1f2b4a73() (Unknown Source:0)
ucrtbased.dll!00007ffc1f2cbb6d() (Unknown Source:0)
unit-doc-02.API-REFERENCE20.exe!jerry_port_fatal(jerry_fatal_code_t code) Line 41 (c:\work\study\languages\typescript\jerryscript\jerry-port\common\jerry-port-process.c:41)
unit-doc-02.API-REFERENCE20.exe!jerry_fatal(jerry_fatal_code_t code) Line 63 (c:\work\study\languages\typescript\jerryscript\jerry-core\jrt\jrt-fatals.c:63)
unit-doc-02.API-REFERENCE20.exe!jerry_assert_fail(const char * assertion, const char * file, const char * function, const unsigned int line) Line 83 (c:\work\study\languages\typescript\jerryscript\jerry-core\jrt\jrt-fatals.c:83)
unit-doc-02.API-REFERENCE20.exe!jmem_heap_finalize() Line 115 (c:\work\study\languages\typescript\jerryscript\jerry-core\jmem\jmem-heap.c:115)
unit-doc-02.API-REFERENCE20.exe!jmem_finalize() Line 171 (c:\work\study\languages\typescript\jerryscript\jerry-core\jmem\jmem-allocator.c:171)
unit-doc-02.API-REFERENCE20.exe!jerry_cleanup() Line 241 (c:\work\study\languages\typescript\jerryscript\jerry-core\api\jerryscript.c:241)
unit-doc-02.API-REFERENCE20.exe!main() Line 4896 (c:\work\study\languages\typescript\jerryscript\docs\02.API-REFERENCE.md:4896)
unit-doc-02.API-REFERENCE20.exe!invoke_main() Line 79 (d:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:79)
unit-doc-02.API-REFERENCE20.exe!__scrt_common_main_seh() Line 288 (d:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
unit-doc-02.API-REFERENCE20.exe!__scrt_common_main() Line 331 (d:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:331)
unit-doc-02.API-REFERENCE20.exe!mainCRTStartup(void * __formal) Line 17 (d:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp:17)
kernel32.dll!00007ffd117f7374() (Unknown Source:0)
ntdll.dll!00007ffd1291cc91() (Unknown Source:0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUndesired behaviourdocumentationRelated to documentationtestRelated to testingwindowsWindows specific

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions