Package org.graalvm.polyglot.tck
Class InlineSnippet
java.lang.Object
org.graalvm.polyglot.tck.InlineSnippet
The unit of execution with an inline source. The
InlineSnippet represents an execution of
a script and an associated inline source code that is to be executed at script's locations.
It's recommended to provide two snippets at least, one with local variables and restricted
location predicate and one with globally accessible
code and no location predicate.
- Since:
- 0.32
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiongetCode()Returns an inline source code that is to be executed at specificlocations, or at all statement and call locations if the predicate isnull.Predicate<org.graalvm.polyglot.SourceSection> Returns a testing predicate for locations at whichsource codeis executed.Returns theResultVerifierto verify the result ofsource codeexecution.Returns a script to be executed.static InlineSnippet.BuildernewBuilder(Snippet script, CharSequence code) Creates a newInlineSnippetbuilder object.toString()
-
Method Details
-
getScript
Returns a script to be executed. Thesource codeis executed inlined in this script.- Since:
- 0.32
-
getCode
Returns an inline source code that is to be executed at specificlocations, or at all statement and call locations if the predicate isnull.- Since:
- 0.32
-
getLocationPredicate
Returns a testing predicate for locations at whichsource codeis executed.- Returns:
- the predicate that returns
trueforSourceSections where thesource codeis to be executed, ornullif the source code should be executed at all instrumentable statement and call locations. - Since:
- 0.32
-
getResultVerifier
Returns theResultVerifierto verify the result ofsource codeexecution.- Returns:
- either a custom or the default
ResultVerifier. - Since:
- 0.32
-
toString
-
newBuilder
Creates a newInlineSnippetbuilder object.- Parameters:
script- the script to execute (useSnippet.newBuilder(String, Value, TypeDescriptor)to create one)code- the inline source code that is to be executed inside the script- Returns:
- the new
InlineSnippet.Builder - Since:
- 0.32
-