diff --git a/binder/ETSBinder.h b/binder/ETSBinder.h index 7f89722bf59626660df77c1e4614fc987d87b004..2646d99b38ef8feb37519a3ed04df567f95715e4 100644 --- a/binder/ETSBinder.h +++ b/binder/ETSBinder.h @@ -140,6 +140,7 @@ import * from "std/core"; import * from "std/math"; import * from "std/containers"; import * from "std/time"; +import * from "std/interop/js"; )"; private: diff --git a/checker/types/globalTypesHolder.cpp b/checker/types/globalTypesHolder.cpp index 35e0dae232fca5455cf5b20ff15c259cb6a6d680..680b7552ab77070a9b962d3c63e80fbec2e590e6 100644 --- a/checker/types/globalTypesHolder.cpp +++ b/checker/types/globalTypesHolder.cpp @@ -133,6 +133,9 @@ GlobalTypesHolder::GlobalTypesHolder(ArenaAllocator *allocator) : builtin_name_m builtin_name_mappings_.emplace("Type", GlobalTypeId::ETS_TYPE_BUILTIN); builtin_name_mappings_.emplace("Types", GlobalTypeId::ETS_TYPES_BUILTIN); builtin_name_mappings_.emplace("Promise", GlobalTypeId::ETS_PROMISE_BUILTIN); + // ETS interop js specific types + builtin_name_mappings_.emplace("JSRuntime", GlobalTypeId::ETS_INTEROP_JSRUNTIME_BUILTIN); + builtin_name_mappings_.emplace("JSValue", GlobalTypeId::ETS_INTEROP_JSVALUE_BUILTIN); } Type *GlobalTypesHolder::GlobalNumberType() diff --git a/checker/types/globalTypesHolder.h b/checker/types/globalTypesHolder.h index ecd27f3cc1f03a026f989021f928187785f0af27..4eed6da904690529ff52d7be74441efce9631da8 100644 --- a/checker/types/globalTypesHolder.h +++ b/checker/types/globalTypesHolder.h @@ -92,6 +92,8 @@ enum class GlobalTypeId { ETS_TYPE_BUILTIN, ETS_TYPES_BUILTIN, ETS_PROMISE_BUILTIN, + ETS_INTEROP_JSRUNTIME_BUILTIN, + ETS_INTEROP_JSVALUE_BUILTIN, COUNT, }; diff --git a/compiler/scripts/signatures.yaml b/compiler/scripts/signatures.yaml index a7e12f1d723e9596c45bb2db032d4132ae935edc..d5f3b163d762eae08dbca42c38e98c85a6cae164 100644 --- a/compiler/scripts/signatures.yaml +++ b/compiler/scripts/signatures.yaml @@ -94,6 +94,8 @@ packages: ref: PKG_STD_CORE - name: 'std.math' ref: PKG_STD_MATH + - name: 'std.interop.js' + ref: PKG_STD_INTEROP_JS primitives: - name: u1 @@ -221,6 +223,12 @@ builtins: - name: Promise package: PKG_STD_CORE ref: BUILTIN_PROMISE + - name: JSRuntime + package: PKG_STD_INTEROP_JS + ref: BUILTIN_JSRUNTIME + - name: JSValue + package: PKG_STD_INTEROP_JS + ref: BUILTIN_JSVALUE signatures: - callee: BUILTIN_OBJECT diff --git a/parser/ETSparser.cpp b/parser/ETSparser.cpp index e000cd6ea77f174ca153bcef931591c41812b2c6..584c5ed60b66c20690dbd3a3d847f3f4a528d216 100644 --- a/parser/ETSparser.cpp +++ b/parser/ETSparser.cpp @@ -231,7 +231,7 @@ static bool IsCompitableExtension(const std::string &extension) std::vector ETSParser::CollectExternalSources() { std::vector paths; - std::vector stdlib = {"std/core", "std/math", "std/containers", "std/time"}; + std::vector stdlib = {"std/core", "std/math", "std/containers", "std/time", "std/interop/js"}; #ifdef USE_UNIX_SYSCALL for (auto const &path : stdlib) {