[vm] Add useful type getters to C API

This allows direct access to String, int, bool, double, Object types
instead of requiring name based lookups via Dart_LookupLibrary and
Dart_GetType.

R=dacoharkes@google.com

TEST=vm/cc/DartAPI_CoreTypes

Change-Id: I2aba317be3b4be21f37d61843a328a5146417e54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/450160
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Auto-Submit: Art Snake <art-snake@yandex-team.ru>
Commit-Queue: Slava Egorov <vegorov@google.com>
This commit is contained in:
Artem Strygin
2025-09-18 04:45:29 -07:00
committed by Commit Queue
parent 9eea7a334d
commit 522e611c9d
5 changed files with 148 additions and 0 deletions
+11
View File
@@ -1892,6 +1892,17 @@ DART_EXPORT Dart_Handle Dart_TypeDynamic(void);
DART_EXPORT Dart_Handle Dart_TypeVoid(void);
DART_EXPORT Dart_Handle Dart_TypeNever(void);
/**
* Returns simple core types.
*
* \return A handle to type.
*/
DART_EXPORT Dart_Handle Dart_TypeString();
DART_EXPORT Dart_Handle Dart_TypeDouble();
DART_EXPORT Dart_Handle Dart_TypeInt();
DART_EXPORT Dart_Handle Dart_TypeBoolean();
DART_EXPORT Dart_Handle Dart_TypeObject();
/**
* Checks if the two objects are equal.
*