[TS] Support `push` invocation in `InstanceCallExpr` resolution

オープン
#300 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

@CaelmBleidd がすでに取り組んでいます。

2025年7月3日 から。

評価

この issue はまだ評価されていません。

説明

Current implementation is

        // TODO write tests
        if (expr.callee.name == "push" && expr.instance.type is EtsArrayType) {
            return scope.calcOnState {
                val resolvedInstance = resolve(expr.instance)?.asExpr(ctx.addressSort) ?: return@calcOnState null
                val lengthLValue = mkArrayLengthLValue(
                    resolvedInstance,
                    EtsArrayType(EtsUnknownType, dimensions = 1)
                )
                val length = memory.read(lengthLValue)
                val newLength = mkBvAddExpr(length, 1.toBv())
                memory.write(lengthLValue, newLength, guard = ctx.trueExpr)
                val resolvedArg = resolve(expr.args.single()) ?: return@calcOnState null

                // TODO check sorts compatibility
                val newIndexLValue = mkArrayIndexLValue(
                    resolvedArg.sort,
                    resolvedInstance,
                    length,
                    EtsArrayType(EtsUnknownType, dimensions = 1)
                )
                memory.write(newIndexLValue, resolvedArg.asExpr(newIndexLValue.sort), guard = ctx.trueExpr)

                newLength
            }
        }

We need to check it and fix if required

主要言語
Kotlin
スター
33
フォーク
27
平均マージ
4日 3時間
マージ済み PR(30日)
15

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

UnitTestBot/usvm のほかの issue

UnitTestBot/usvm の issue をすべて見る

似ている issue

Kotlin の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。