Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ jobs:

- name: Set up ArkAnalyzer
run: |
REPO_URL="https://gitee.com/openharmony-sig/arkanalyzer.git"
REPO_URL="https://gitee.com/Lipenx/arkanalyzer.git"
DEST_DIR="arkanalyzer"
MAX_RETRIES=10
RETRY_DELAY=3 # Delay between retries in seconds
BRANCH="neo/2024-08-07"

for ((i=1; i<=MAX_RETRIES; i++)); do
git clone --depth=1 $REPO_URL $DEST_DIR && break
git clone --depth=1 --branch $BRANCH $REPO_URL $DEST_DIR && break
echo "Clone failed, retrying in $RETRY_DELAY seconds..."
sleep "$RETRY_DELAY"
done
Expand All @@ -81,17 +82,6 @@ jobs:
echo "ARKANALYZER_DIR=$(realpath $DEST_DIR)" >> $GITHUB_ENV
cd $DEST_DIR

# checkout master on 2024-07-17
rev=a9d9fd6070fce5896d8e760ed7fd175b62b16605

for ((i=1; i<=MAX_RETRIES; i++)); do
git fetch --depth=1 origin $rev && break
echo "Fetch failed, retrying in $RETRY_DELAY seconds..."
sleep "$RETRY_DELAY"
done

git switch --detach $rev

npm install
npm run build

Expand Down
1 change: 1 addition & 0 deletions jacodb-ets/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies {
implementation(Libs.kotlinx_serialization_json)
implementation(Libs.jdot)

testImplementation(kotlin("test"))
testImplementation(project(":jacodb-analysis"))
testImplementation(testFixtures(project(":jacodb-core")))
testImplementation(Libs.mockk)
Expand Down
38 changes: 36 additions & 2 deletions jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ interface EtsExpr : EtsEntity {

// Unary
fun visit(expr: EtsDeleteExpr): R
fun visit(expr: EtsAwaitExpr): R
fun visit(expr: EtsYieldExpr): R
fun visit(expr: EtsTypeOfExpr): R
fun visit(expr: EtsVoidExpr): R
fun visit(expr: EtsNotExpr): R
Expand Down Expand Up @@ -88,6 +90,8 @@ interface EtsExpr : EtsEntity {
override fun visit(expr: EtsInstanceOfExpr): R = defaultVisit(expr)

override fun visit(expr: EtsDeleteExpr): R = defaultVisit(expr)
override fun visit(expr: EtsAwaitExpr): R = defaultVisit(expr)
override fun visit(expr: EtsYieldExpr): R = defaultVisit(expr)
override fun visit(expr: EtsTypeOfExpr): R = defaultVisit(expr)
override fun visit(expr: EtsVoidExpr): R = defaultVisit(expr)
override fun visit(expr: EtsNotExpr): R = defaultVisit(expr)
Expand Down Expand Up @@ -202,7 +206,7 @@ data class EtsCastExpr(

data class EtsInstanceOfExpr(
val arg: EtsEntity,
val checkType: String, // TODO: what should it be?
val checkType: EtsType,
) : EtsExpr {
override val type: EtsType
get() = EtsBooleanType
Expand Down Expand Up @@ -235,6 +239,36 @@ data class EtsDeleteExpr(
}
}

data class EtsAwaitExpr(
override val arg: EtsEntity,
) : EtsUnaryExpr {
override val type: EtsType
get() = arg.type

override fun toString(): String {
return "await $arg"
}

override fun <R> accept(visitor: EtsExpr.Visitor<R>): R {
return visitor.visit(this)
}
}

data class EtsYieldExpr(
override val arg: EtsEntity,
) : EtsUnaryExpr {
override val type: EtsType
get() = arg.type

override fun toString(): String {
return "yield $arg"
}

override fun <R> accept(visitor: EtsExpr.Visitor<R>): R {
return visitor.visit(this)
}
}

data class EtsTypeOfExpr(
override val arg: EtsEntity,
) : EtsUnaryExpr {
Expand Down Expand Up @@ -730,7 +764,7 @@ interface EtsCallExpr : EtsExpr, CommonCallExpr {
}

data class EtsInstanceCallExpr(
val instance: EtsEntity,
val instance: EtsLocal,
override val method: EtsMethodSignature,
override val args: List<EtsValue>,
) : EtsCallExpr {
Expand Down
2 changes: 1 addition & 1 deletion jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsRef.kt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ interface EtsFieldRef : EtsRef, EtsLValue {
}

data class EtsInstanceFieldRef(
val instance: EtsEntity, // Local
val instance: EtsLocal,
override val field: EtsFieldSignature,
) : EtsFieldRef {
override fun toString(): String {
Expand Down
6 changes: 3 additions & 3 deletions jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interface EtsType : CommonType, CommonTypeName {
fun visit(type: EtsNeverType): R
fun visit(type: EtsLiteralType): R
fun visit(type: EtsClassType): R
fun visit(type: EtsCallableType): R
fun visit(type: EtsFunctionType): R
fun visit(type: EtsArrayType): R
fun visit(type: EtsArrayObjectType): R
fun visit(type: EtsUnclearRefType): R
Expand All @@ -60,7 +60,7 @@ interface EtsType : CommonType, CommonTypeName {
override fun visit(type: EtsNeverType): R = defaultVisit(type)
override fun visit(type: EtsLiteralType): R = defaultVisit(type)
override fun visit(type: EtsClassType): R = defaultVisit(type)
override fun visit(type: EtsCallableType): R = defaultVisit(type)
override fun visit(type: EtsFunctionType): R = defaultVisit(type)
override fun visit(type: EtsArrayType): R = defaultVisit(type)
override fun visit(type: EtsArrayObjectType): R = defaultVisit(type)
override fun visit(type: EtsUnclearRefType): R = defaultVisit(type)
Expand Down Expand Up @@ -227,7 +227,7 @@ data class EtsClassType(
}
}

data class EtsCallableType(
data class EtsFunctionType(
val method: EtsMethodSignature,
) : EtsRefType {
override val typeName: String
Expand Down
Loading