Skip to content

Commit 9c5da0d

Browse files
committed
Improve jerry_is_feature_enabled with object availability information
JerryScript-DCO-1.0-Signed-off-by: Zsolt Raduska [email protected]
1 parent 29b337d commit 9c5da0d

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
@@ -865,6 +865,21 @@ bool jerry_is_feature_enabled (const jerry_feature_t feature)
865865
#ifdef JERRY_VM_EXEC_STOP
866866
|| feature == JERRY_FEATURE_VM_EXEC_STOP
867867
#endif /* JERRY_VM_EXEC_STOP */
868+
#ifndef CONFIG_DISABLE_JSON_BUILTIN
869+
|| feature == JERRY_FEATURE_JSON
870+
#endif /* !CONFIG_DISABLE_JSON_BUILTIN */
871+
#ifndef CONFIG_DISABLE_ES2015_PROMISE_BUILTIN
872+
|| feature == JERRY_FEATURE_PROMISE
873+
#endif /* !CONFIG_DISABLE_ES2015_PROMISE_BUILTIN */
874+
#ifndef CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN
875+
|| feature == JERRY_FEATURE_TYPEDARRAY
876+
#endif /* !CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN */
877+
#ifndef CONFIG_DISABLE_DATE_BUILTIN
878+
|| feature == JERRY_FEATURE_DATE
879+
#endif /* !CONFIG_DISABLE_DATE_BUILTIN */
880+
#ifndef CONFIG_DISABLE_REGEXP_BUILTIN
881+
|| feature == JERRY_FEATURE_REGEXP
882+
#endif /* !CONFIG_DISABLE_REGEXP_BUILTIN */
868883
);
869884
} /* jerry_is_feature_enabled */
870885

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)