Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update code to match the current ArkAnalyzer #255

Merged
merged 11 commits into from
Aug 8, 2024
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 @@

// 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 @@
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)

Check warning on line 94 in jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt

View check run for this annotation

Codecov / codecov/patch

jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt#L93-L94

Added lines #L93 - L94 were not covered by tests
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 EtsInstanceOfExpr(
val arg: EtsEntity,
val checkType: String, // TODO: what should it be?
val checkType: EtsType,

Check warning on line 209 in jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt

View check run for this annotation

Codecov / codecov/patch

jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt#L209

Added line #L209 was not covered by tests
) : EtsExpr {
override val type: EtsType
get() = EtsBooleanType
Expand Down Expand Up @@ -235,6 +239,36 @@
}
}

data class EtsAwaitExpr(
override val arg: EtsEntity,

Check warning on line 243 in jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt

View check run for this annotation

Codecov / codecov/patch

jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt#L242-L243

Added lines #L242 - L243 were not covered by tests
) : EtsUnaryExpr {
override val type: EtsType
get() = arg.type

Check warning on line 246 in jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt

View check run for this annotation

Codecov / codecov/patch

jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt#L246

Added line #L246 was not covered by tests

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

Check warning on line 249 in jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt

View check run for this annotation

Codecov / codecov/patch

jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt#L249

Added line #L249 was not covered by tests
}

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

Check warning on line 253 in jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt

View check run for this annotation

Codecov / codecov/patch

jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt#L253

Added line #L253 was not covered by tests
}
}

data class EtsYieldExpr(
override val arg: EtsEntity,

Check warning on line 258 in jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt

View check run for this annotation

Codecov / codecov/patch

jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt#L257-L258

Added lines #L257 - L258 were not covered by tests
) : EtsUnaryExpr {
override val type: EtsType
get() = arg.type

Check warning on line 261 in jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt

View check run for this annotation

Codecov / codecov/patch

jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt#L261

Added line #L261 was not covered by tests

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

Check warning on line 264 in jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt

View check run for this annotation

Codecov / codecov/patch

jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt#L264

Added line #L264 was not covered by tests
}

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

Check warning on line 268 in jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt

View check run for this annotation

Codecov / codecov/patch

jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsExpr.kt#L268

Added line #L268 was not covered by tests
}
}

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

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 @@
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 @@
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)

Check warning on line 63 in jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsType.kt

View check run for this annotation

Codecov / codecov/patch

jacodb-ets/src/main/kotlin/org/jacodb/ets/base/EtsType.kt#L63

Added line #L63 was not covered by tests
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 EtsCallableType(
data class EtsFunctionType(
val method: EtsMethodSignature,
) : EtsRefType {
override val typeName: String
Expand Down
Loading
Loading