diff --git a/lang/js/src/main/scala/JsAPI.scala b/lang/js/src/main/scala/com/wavesplatform/JsAPI.scala similarity index 99% rename from lang/js/src/main/scala/JsAPI.scala rename to lang/js/src/main/scala/com/wavesplatform/JsAPI.scala index 92a8d947a3a..7a5f3eae35d 100644 --- a/lang/js/src/main/scala/JsAPI.scala +++ b/lang/js/src/main/scala/com/wavesplatform/JsAPI.scala @@ -1,3 +1,5 @@ +package com.wavesplatform + import JsApiUtils.* import com.wavesplatform.DocSource import com.wavesplatform.lang.* diff --git a/lang/js/src/main/scala/JsApiUtils.scala b/lang/js/src/main/scala/com/wavesplatform/JsApiUtils.scala similarity index 90% rename from lang/js/src/main/scala/JsApiUtils.scala rename to lang/js/src/main/scala/com/wavesplatform/JsApiUtils.scala index fdf15621f4d..68d66f78eae 100644 --- a/lang/js/src/main/scala/JsApiUtils.scala +++ b/lang/js/src/main/scala/com/wavesplatform/JsApiUtils.scala @@ -1,3 +1,5 @@ +package com.wavesplatform + import com.wavesplatform.lang.contract.DApp import com.wavesplatform.lang.v1.FunctionHeader.{Native, User} import com.wavesplatform.lang.v1.compiler.CompilationError @@ -14,7 +16,7 @@ import scala.scalajs.js.JSConverters._ object JsApiUtils { def serPart[T](f: T => js.Any)(part: PART[T]): js.Object = { - val partValue = Expressions.PART.toOption(part).fold(null:Any)(f) + val partValue = Expressions.PART.toOption(part).fold(null: Any)(f) jObj.applyDynamic("apply")( "value" -> partValue, "posStart" -> part.position.start, @@ -55,11 +57,11 @@ object JsApiUtils { } jObj.applyDynamic("apply")( - "type" -> "DAPP", - "posStart" -> ast.position.start, - "posEnd" -> ast.position.end, - "decList" -> ast.decs.map(serDec).toJSArray, - "annFuncList" -> ast.fs.map(serAnnFunc).toJSArray + "type" -> "DAPP", + "posStart" -> ast.position.start, + "posEnd" -> ast.position.end, + "decList" -> ast.decs.map(serDec).toJSArray, + "annFuncList" -> ast.fs.map(serAnnFunc).toJSArray ) } @@ -146,8 +148,8 @@ object JsApiUtils { case Expressions.FOLD(_, limit, value, acc, func, _, _) => val additionalDataObj = jObj.applyDynamic("apply")( - "name" -> s"FOLD<$limit>", - "args" -> js.Array(serExpr(value), serExpr(acc), func.key.toString: js.Any) + "name" -> s"FOLD<$limit>", + "args" -> js.Array(serExpr(value), serExpr(acc), func.key.toString: js.Any) ) mergeJSObjects(commonDataObj, additionalDataObj) @@ -173,7 +175,9 @@ object JsApiUtils { } def serMatchCase(c: Expressions.MATCH_CASE, simpleCtx: Map[String, Pos]): js.Object = { - val vars = c.pattern.subpatterns.collect { case (Expressions.TypedVar(Some(newVarName), caseType), _) => (serPartStr(newVarName), serType(caseType)) } + val vars = c.pattern.subpatterns.collect { case (Expressions.TypedVar(Some(newVarName), caseType), _) => + (serPartStr(newVarName), serType(caseType)) + } jObj.applyDynamic("apply")( "type" -> "MATCH_CASE", "posStart" -> c.position.start, @@ -200,7 +204,7 @@ object JsApiUtils { t match { case Expressions.AnyType(_) => jObj.applyDynamic("apply")( - "typeName" -> "Any" + "typeName" -> "Any" ) case Expressions.Single(name, parameter) => jObj.applyDynamic("apply")( @@ -255,21 +259,25 @@ object JsApiUtils { def toJs(ast: EXPR): js.Object = { def r(expr: EXPR): js.Object = { expr match { - case CONST_LONG(t) => jObj.applyDynamic("apply")("type" -> "LONG", "value" -> t.toDouble) - case GETTER(ref, field) => jObj.applyDynamic("apply")("type" -> "GETTER", "ref" -> r(ref), "field" -> field) + case CONST_LONG(t) => jObj.applyDynamic("apply")("type" -> "LONG", "value" -> t.toDouble) + case GETTER(ref, field) => jObj.applyDynamic("apply")("type" -> "GETTER", "ref" -> r(ref), "field" -> field) case CONST_BYTESTR(bs) => jObj.applyDynamic("apply")("type" -> "BYTESTR", "value" -> bs.arr.toJSArray) - case CONST_STRING(s) => jObj.applyDynamic("apply")("type" -> "STRING", "value" -> s) + case CONST_STRING(s) => jObj.applyDynamic("apply")("type" -> "STRING", "value" -> s) case LET_BLOCK(let, body) => jObj.applyDynamic("apply")("type" -> "BLOCK", "let" -> jObj("name" -> let.name, "value" -> r(let.value)), "body" -> r(body)) case IF(cond, ifTrue, ifFalse) => jObj.applyDynamic("apply")("type" -> "IF", "condition" -> r(cond), "true" -> r(ifTrue), "false" -> r(ifFalse)) - case REF(key) => jObj.applyDynamic("apply")("type" -> "REF", "key" -> key) + case REF(key) => jObj.applyDynamic("apply")("type" -> "REF", "key" -> key) case CONST_BOOLEAN(b) => jObj.applyDynamic("apply")("type" -> "BOOL", "value" -> b) case FUNCTION_CALL(function, args) => - jObj.applyDynamic("apply")("type" -> "CALL", "name" -> (function match { - case Native(name) => name.toString() - case User(internalName, _) => internalName - }), "args" -> args.map(r).toJSArray) + jObj.applyDynamic("apply")( + "type" -> "CALL", + "name" -> (function match { + case Native(name) => name.toString() + case User(internalName, _) => internalName + }), + "args" -> args.map(r).toJSArray + ) case t => jObj.applyDynamic("apply")("[not_supported]stringRepr" -> t.toString) } } diff --git a/lang/tests-js/src/test/scala/DAppComplexities.scala b/lang/tests-js/src/test/scala/com/wavesplatform/DAppComplexities.scala similarity index 89% rename from lang/tests-js/src/test/scala/DAppComplexities.scala rename to lang/tests-js/src/test/scala/com/wavesplatform/DAppComplexities.scala index 1876fb85215..892522f1c59 100644 --- a/lang/tests-js/src/test/scala/DAppComplexities.scala +++ b/lang/tests-js/src/test/scala/com/wavesplatform/DAppComplexities.scala @@ -1,3 +1,5 @@ +package com.wavesplatform + case class DAppComplexities( complexity: Int, verifierComplexity: Int, diff --git a/lang/tests-js/src/test/scala/Global.scala b/lang/tests-js/src/test/scala/com/wavesplatform/Global.scala similarity index 91% rename from lang/tests-js/src/test/scala/Global.scala rename to lang/tests-js/src/test/scala/com/wavesplatform/Global.scala index f8a49245087..99a61503521 100644 --- a/lang/tests-js/src/test/scala/Global.scala +++ b/lang/tests-js/src/test/scala/com/wavesplatform/Global.scala @@ -1,3 +1,5 @@ +package com.wavesplatform + import scala.scalajs.js.annotation.JSExportTopLevel import scala.scalajs.js.typedarray.ArrayBuffer diff --git a/lang/tests-js/src/test/scala/JsAPITest.scala b/lang/tests-js/src/test/scala/com/wavesplatform/JsAPITest.scala similarity index 99% rename from lang/tests-js/src/test/scala/JsAPITest.scala rename to lang/tests-js/src/test/scala/com/wavesplatform/JsAPITest.scala index 88f74e9100c..25416408df5 100644 --- a/lang/tests-js/src/test/scala/JsAPITest.scala +++ b/lang/tests-js/src/test/scala/com/wavesplatform/JsAPITest.scala @@ -1,3 +1,5 @@ +package com.wavesplatform + import com.wavesplatform.lang.directives.values.{V5, V6} import utest.* diff --git a/lang/tests-js/src/test/scala/JsTestBase.scala b/lang/tests-js/src/test/scala/com/wavesplatform/JsTestBase.scala similarity index 98% rename from lang/tests-js/src/test/scala/JsTestBase.scala rename to lang/tests-js/src/test/scala/com/wavesplatform/JsTestBase.scala index 6f2e970a747..ac04371ba18 100644 --- a/lang/tests-js/src/test/scala/JsTestBase.scala +++ b/lang/tests-js/src/test/scala/com/wavesplatform/JsTestBase.scala @@ -1,3 +1,5 @@ +package com.wavesplatform + import com.wavesplatform.lang.directives.values.{StdLibVersion, V6} import utest.{TestSuite, assert}