Skip to content

Commit 0476523

Browse files
ZsoltRaduskaLaszloLango
authored andcommitted
Improve jerry_is_feature_enabled with object availability information (#2250)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Raduska [email protected]
1 parent f06d637 commit 0476523

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

docs/02.API-REFERENCE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ Possible compile time enabled feature types:
5353
- JERRY_FEATURE_SNAPSHOT_EXEC - executing snapshot files
5454
- JERRY_FEATURE_DEBUGGER - debugging
5555
- JERRY_FEATURE_VM_EXEC_STOP - stopping ECMAScript execution
56+
- JERRY_FEATURE_JSON - JSON support
57+
- JERRY_FEATURE_PROMISE - promise support
58+
- JERRY_FEATURE_TYPEDARRAY - Typedarray support
59+
- JERRY_FEATURE_DATE - Date support
60+
- JERRY_FEATURE_REGEXP - RegExp support
5661

5762
## jerry_char_t
5863

jerry-core/api/jerry.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,21 @@ bool jerry_is_feature_enabled (const jerry_feature_t feature)
864864
#ifdef JERRY_VM_EXEC_STOP
865865
|| feature == JERRY_FEATURE_VM_EXEC_STOP
866866
#endif /* JERRY_VM_EXEC_STOP */
867+
#ifndef CONFIG_DISABLE_JSON_BUILTIN
868+
|| feature == JERRY_FEATURE_JSON
869+
#endif /* !CONFIG_DISABLE_JSON_BUILTIN */
870+
#ifndef CONFIG_DISABLE_ES2015_PROMISE_BUILTIN
871+
|| feature == JERRY_FEATURE_PROMISE
872+
#endif /* !CONFIG_DISABLE_ES2015_PROMISE_BUILTIN */
873+
#ifndef CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN
874+
|| feature == JERRY_FEATURE_TYPEDARRAY
875+
#endif /* !CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN */
876+
#ifndef CONFIG_DISABLE_DATE_BUILTIN
877+
|| feature == JERRY_FEATURE_DATE
878+
#endif /* !CONFIG_DISABLE_DATE_BUILTIN */
879+
#ifndef CONFIG_DISABLE_REGEXP_BUILTIN
880+
|| feature == JERRY_FEATURE_REGEXP
881+
#endif /* !CONFIG_DISABLE_REGEXP_BUILTIN */
867882
);
868883
} /* jerry_is_feature_enabled */
869884

jerry-core/include/jerryscript-core.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ typedef enum
9090
JERRY_FEATURE_SNAPSHOT_EXEC, /**< executing snapshot files */
9191
JERRY_FEATURE_DEBUGGER, /**< debugging */
9292
JERRY_FEATURE_VM_EXEC_STOP, /**< stopping ECMAScript execution */
93+
JERRY_FEATURE_JSON, /**< JSON support */
94+
JERRY_FEATURE_PROMISE, /**< promise support */
95+
JERRY_FEATURE_TYPEDARRAY, /**< Typedarray support */
96+
JERRY_FEATURE_DATE, /**< Date support */
97+
JERRY_FEATURE_REGEXP, /**< Regexp support */
9398
JERRY_FEATURE__COUNT /**< number of features. NOTE: must be at the end of the list */
9499
} jerry_feature_t;
95100

0 commit comments

Comments
 (0)