diff --git a/kmath-ast/src/jsMain/kotlin/astring.global.kt b/kmath-ast/src/jsMain/kotlin/astring.global.kt deleted file mode 100644 index d8514c310..000000000 --- a/kmath-ast/src/jsMain/kotlin/astring.global.kt +++ /dev/null @@ -1,17 +0,0 @@ -@file:JsQualifier("global") -@file:Suppress( - "INTERFACE_WITH_SUPERCLASS", "OVERRIDING_FINAL_MEMBER", "RETURN_TYPE_MISMATCH_ON_OVERRIDE", "CONFLICTING_OVERLOADS", - "NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING", "KDocMissingDocumentation", "PackageDirectoryMismatch", "ClassName" -) - -package global - -import Generator - -@Suppress("EXTERNAL_DELEGATION", "NESTED_CLASS_IN_EXTERNAL_INTERFACE") -external interface astring { - var generate: (dynamic, dynamic) -> dynamic - var baseGenerator: Generator - - companion object : astring by definedExternally -} diff --git a/kmath-ast/src/jsMain/kotlin/astring.typealises.kt b/kmath-ast/src/jsMain/kotlin/astring.typealises.kt deleted file mode 100644 index 9b74e2d04..000000000 --- a/kmath-ast/src/jsMain/kotlin/astring.typealises.kt +++ /dev/null @@ -1,3 +0,0 @@ -@file:Suppress("NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING", "KDocMissingDocumentation") - -typealias Generator = Any diff --git a/kmath-ast/src/jsMain/kotlin/estree.extensions.kt b/kmath-ast/src/jsMain/kotlin/estree.extensions.kt deleted file mode 100644 index d4fc4baa1..000000000 --- a/kmath-ast/src/jsMain/kotlin/estree.extensions.kt +++ /dev/null @@ -1,67 +0,0 @@ -@file:Suppress( - "NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING", "KDocMissingDocumentation", - "NO_EXPLICIT_RETURN_TYPE_IN_API_MODE_WARNING", "PackageDirectoryMismatch" -) - -package estree - -fun Program(sourceType: String, vararg body: dynamic) = object : Program { - override var type = "Program" - override var sourceType = sourceType - override var body = body -} - -fun VariableDeclaration(kind: String, vararg declarations: VariableDeclarator) = object : VariableDeclaration { - override var type = "VariableDeclaration" - override var declarations = declarations.toList().toTypedArray() - override var kind = kind -} - -fun VariableDeclarator(id: dynamic, init: dynamic) = object : VariableDeclarator { - override var type = "VariableDeclarator" - override var id = id - override var init = init -} - -fun Identifier(name: String) = object : Identifier { - override var type = "Identifier" - override var name = name -} - -fun FunctionExpression(params: Array, body: BlockStatement) = object : FunctionExpression { - override var params = params - override var type = "FunctionExpression" - override var body = body -} - -fun BlockStatement(vararg body: dynamic) = object : BlockStatement { - override var type = "BlockStatement" - override var body = body -} - -fun ReturnStatement(argument: dynamic) = object : ReturnStatement { - override var type = "ReturnStatement" - override var argument = argument -} - -fun SimpleLiteral(value: dynamic) = object : SimpleLiteral { - override var type = "Literal" - override var value = value -} - -fun MemberExpression(computed: Boolean, optional: Boolean, `object`: dynamic, property: dynamic) = - object : MemberExpression { - override var type = "MemberExpression" - override var computed = computed - override var optional = optional - override var `object` = `object` - override var property = property - } - -fun SimpleCallExpression(optional: Boolean, callee: dynamic, vararg arguments: dynamic) = - object : SimpleCallExpression { - override var type = "CallExpression" - override var optional = optional - override var callee = callee - override var arguments = arguments - } diff --git a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/JSBuilder.kt b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/JSBuilder.kt index c6a36b538..b38be085d 100644 --- a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/JSBuilder.kt +++ b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/JSBuilder.kt @@ -1,18 +1,29 @@ package kscience.kmath.estree.internal -import astring.generate +import kscience.kmath.estree.internal.astring.generate import estree.* +import kscience.kmath.estree.internal.estree.* +import kscience.kmath.estree.internal.estree.BlockStatement +import kscience.kmath.estree.internal.estree.FunctionExpression +import kscience.kmath.estree.internal.estree.Identifier +import kscience.kmath.estree.internal.estree.MemberExpression +import kscience.kmath.estree.internal.estree.Program +import kscience.kmath.estree.internal.estree.ReturnStatement +import kscience.kmath.estree.internal.estree.SimpleCallExpression +import kscience.kmath.estree.internal.estree.SimpleLiteral +import kscience.kmath.estree.internal.estree.VariableDeclaration +import kscience.kmath.estree.internal.estree.VariableDeclarator import kscience.kmath.expressions.Expression import kscience.kmath.expressions.Symbol internal class JSBuilder(val bodyCallback: JSBuilder.() -> BaseExpression) { private class GeneratedExpression(val executable: dynamic, val constants: Array) : Expression { @Suppress("UNUSED_VARIABLE", "PARAMETER_NAME_CHANGED_ON_OVERRIDE") - override fun invoke(map: Map): T { + override fun invoke(arguments: Map): T { val e = executable val c = constants val a = js("{}") - map.forEach { (key, value) -> a[key.identity] = value } + arguments.forEach { (key, value) -> a[key.identity] = value } return js("e(c, a)").unsafeCast() } } diff --git a/kmath-ast/src/jsMain/kotlin/astring.kt b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/astring/astring.kt similarity index 57% rename from kmath-ast/src/jsMain/kotlin/astring.kt rename to kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/astring/astring.kt index fe2b2da0a..4ef3acf20 100644 --- a/kmath-ast/src/jsMain/kotlin/astring.kt +++ b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/astring/astring.kt @@ -1,16 +1,11 @@ -@file:Suppress( - "INTERFACE_WITH_SUPERCLASS", "OVERRIDING_FINAL_MEMBER", "RETURN_TYPE_MISMATCH_ON_OVERRIDE", "CONFLICTING_OVERLOADS", - "NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING", "KDocMissingDocumentation", "PackageDirectoryMismatch" -) - @file:JsModule("astring") @file:JsNonModule -package astring -import Generator +package kscience.kmath.estree.internal.astring + import estree.BaseNode -external interface Options { +internal external interface Options { var indent: String? get() = definedExternally set(value) = definedExternally @@ -31,8 +26,8 @@ external interface Options { set(value) = definedExternally } -external fun generate(node: BaseNode, options: Options /* Options & `T$0` */ = definedExternally): String +internal external fun generate(node: BaseNode, options: Options /* Options & `T$0` */ = definedExternally): String -external fun generate(node: BaseNode): String +internal external fun generate(node: BaseNode): String -external var baseGenerator: Generator +internal external var baseGenerator: Generator diff --git a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/astring/astring.typealises.kt b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/astring/astring.typealises.kt new file mode 100644 index 000000000..5a7fe4f16 --- /dev/null +++ b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/astring/astring.typealises.kt @@ -0,0 +1,3 @@ +package kscience.kmath.estree.internal.astring + +internal typealias Generator = Any diff --git a/kmath-ast/src/jsMain/kotlin/emitter.kt b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/emitter/emitter.kt similarity index 51% rename from kmath-ast/src/jsMain/kotlin/emitter.kt rename to kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/emitter/emitter.kt index 94398397f..1e0a95a16 100644 --- a/kmath-ast/src/jsMain/kotlin/emitter.kt +++ b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/emitter/emitter.kt @@ -1,14 +1,6 @@ -@file:Suppress( - "INTERFACE_WITH_SUPERCLASS", - "OVERRIDING_FINAL_MEMBER", - "RETURN_TYPE_MISMATCH_ON_OVERRIDE", - "CONFLICTING_OVERLOADS", "NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING", "KDocMissingDocumentation", "SortModifiers", - "PackageDirectoryMismatch" -) +package kscience.kmath.estree.internal.emitter -package emitter - -external open class Emitter { +internal open external class Emitter { constructor(obj: Any) constructor() @@ -18,4 +10,4 @@ external open class Emitter { open fun emit(event: String, vararg any: Any) open fun listeners(event: String): Array<() -> Unit> open fun hasListeners(event: String): Boolean -} \ No newline at end of file +} diff --git a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/estree/estree.extensions.kt b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/estree/estree.extensions.kt new file mode 100644 index 000000000..951cd9ef8 --- /dev/null +++ b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/estree/estree.extensions.kt @@ -0,0 +1,74 @@ +package kscience.kmath.estree.internal.estree + +import estree.* +import estree.BlockStatement +import estree.FunctionExpression +import estree.Identifier +import estree.MemberExpression +import estree.Program +import estree.ReturnStatement +import estree.SimpleCallExpression +import estree.SimpleLiteral +import estree.VariableDeclaration +import estree.VariableDeclarator + +internal fun Program(sourceType: String, vararg body: dynamic) = object : Program { + override var type = "Program" + override var sourceType = sourceType + override var body = body +} + +internal fun VariableDeclaration(kind: String, vararg declarations: VariableDeclarator) = object : VariableDeclaration { + override var type = "VariableDeclaration" + override var declarations = declarations.toList().toTypedArray() + override var kind = kind +} + +internal fun VariableDeclarator(id: dynamic, init: dynamic) = object : VariableDeclarator { + override var type = "VariableDeclarator" + override var id = id + override var init = init +} + +internal fun Identifier(name: String) = object : Identifier { + override var type = "Identifier" + override var name = name +} + +internal fun FunctionExpression(params: Array, body: BlockStatement) = object : FunctionExpression { + override var params = params + override var type = "FunctionExpression" + override var body = body +} + +internal fun BlockStatement(vararg body: dynamic) = object : BlockStatement { + override var type = "BlockStatement" + override var body = body +} + +internal fun ReturnStatement(argument: dynamic) = object : ReturnStatement { + override var type = "ReturnStatement" + override var argument = argument +} + +internal fun SimpleLiteral(value: dynamic) = object : SimpleLiteral { + override var type = "Literal" + override var value = value +} + +internal fun MemberExpression(computed: Boolean, optional: Boolean, `object`: dynamic, property: dynamic) = + object : MemberExpression { + override var type = "MemberExpression" + override var computed = computed + override var optional = optional + override var `object` = `object` + override var property = property + } + +internal fun SimpleCallExpression(optional: Boolean, callee: dynamic, vararg arguments: dynamic) = + object : SimpleCallExpression { + override var type = "CallExpression" + override var optional = optional + override var callee = callee + override var arguments = arguments + } diff --git a/kmath-ast/src/jsMain/kotlin/estree.kt b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/estree/estree.kt similarity index 88% rename from kmath-ast/src/jsMain/kotlin/estree.kt rename to kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/estree/estree.kt index 79d043eae..8d894a1b1 100644 --- a/kmath-ast/src/jsMain/kotlin/estree.kt +++ b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/estree/estree.kt @@ -1,13 +1,8 @@ -@file:Suppress( - "INTERFACE_WITH_SUPERCLASS", "OVERRIDING_FINAL_MEMBER", "RETURN_TYPE_MISMATCH_ON_OVERRIDE", "CONFLICTING_OVERLOADS", - "NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING", "KDocMissingDocumentation", "ClassName", "PackageDirectoryMismatch", -) - package estree import kotlin.js.RegExp -external interface BaseNodeWithoutComments { +internal external interface BaseNodeWithoutComments { var type: String var loc: SourceLocation? get() = definedExternally @@ -17,7 +12,7 @@ external interface BaseNodeWithoutComments { set(value) = definedExternally } -external interface BaseNode : BaseNodeWithoutComments { +internal external interface BaseNode : BaseNodeWithoutComments { var leadingComments: Array? get() = definedExternally set(value) = definedExternally @@ -26,12 +21,12 @@ external interface BaseNode : BaseNodeWithoutComments { set(value) = definedExternally } -external interface Comment : BaseNodeWithoutComments { +internal external interface Comment : BaseNodeWithoutComments { override var type: String /* "Line" | "Block" */ var value: String } -external interface SourceLocation { +internal external interface SourceLocation { var source: String? get() = definedExternally set(value) = definedExternally @@ -39,12 +34,12 @@ external interface SourceLocation { var end: Position } -external interface Position { +internal external interface Position { var line: Number var column: Number } -external interface Program : BaseNode { +internal external interface Program : BaseNode { override var type: String /* "Program" */ var sourceType: String /* "script" | "module" */ var body: Array @@ -53,7 +48,7 @@ external interface Program : BaseNode { set(value) = definedExternally } -external interface Directive : BaseNode { +internal external interface Directive : BaseNode { override var type: String /* "ExpressionStatement" */ var expression: dynamic /* SimpleLiteral | RegExpLiteral */ get() = definedExternally @@ -61,7 +56,7 @@ external interface Directive : BaseNode { var directive: String } -external interface BaseFunction : BaseNode { +internal external interface BaseFunction : BaseNode { var params: Array var generator: Boolean? get() = definedExternally @@ -74,13 +69,13 @@ external interface BaseFunction : BaseNode { set(value) = definedExternally } -external interface BaseStatement : BaseNode +internal external interface BaseStatement : BaseNode -external interface EmptyStatement : BaseStatement { +internal external interface EmptyStatement : BaseStatement { override var type: String /* "EmptyStatement" */ } -external interface BlockStatement : BaseStatement { +internal external interface BlockStatement : BaseStatement { override var type: String /* "BlockStatement" */ var body: Array var innerComments: Array? @@ -88,14 +83,14 @@ external interface BlockStatement : BaseStatement { set(value) = definedExternally } -external interface ExpressionStatement : BaseStatement { +internal external interface ExpressionStatement : BaseStatement { override var type: String /* "ExpressionStatement" */ var expression: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */ get() = definedExternally set(value) = definedExternally } -external interface IfStatement : BaseStatement { +internal external interface IfStatement : BaseStatement { override var type: String /* "IfStatement" */ var test: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */ get() = definedExternally @@ -108,7 +103,7 @@ external interface IfStatement : BaseStatement { set(value) = definedExternally } -external interface LabeledStatement : BaseStatement { +internal external interface LabeledStatement : BaseStatement { override var type: String /* "LabeledStatement" */ var label: Identifier var body: dynamic /* ExpressionStatement | BlockStatement | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | FunctionDeclaration | VariableDeclaration | ClassDeclaration */ @@ -116,21 +111,21 @@ external interface LabeledStatement : BaseStatement { set(value) = definedExternally } -external interface BreakStatement : BaseStatement { +internal external interface BreakStatement : BaseStatement { override var type: String /* "BreakStatement" */ var label: Identifier? get() = definedExternally set(value) = definedExternally } -external interface ContinueStatement : BaseStatement { +internal external interface ContinueStatement : BaseStatement { override var type: String /* "ContinueStatement" */ var label: Identifier? get() = definedExternally set(value) = definedExternally } -external interface WithStatement : BaseStatement { +internal external interface WithStatement : BaseStatement { override var type: String /* "WithStatement" */ var `object`: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */ get() = definedExternally @@ -140,7 +135,7 @@ external interface WithStatement : BaseStatement { set(value) = definedExternally } -external interface SwitchStatement : BaseStatement { +internal external interface SwitchStatement : BaseStatement { override var type: String /* "SwitchStatement" */ var discriminant: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */ get() = definedExternally @@ -148,21 +143,21 @@ external interface SwitchStatement : BaseStatement { var cases: Array } -external interface ReturnStatement : BaseStatement { +internal external interface ReturnStatement : BaseStatement { override var type: String /* "ReturnStatement" */ var argument: dynamic /* ThisExpression? | ArrayExpression? | ObjectExpression? | FunctionExpression? | ArrowFunctionExpression? | YieldExpression? | SimpleLiteral? | RegExpLiteral? | UnaryExpression? | UpdateExpression? | BinaryExpression? | AssignmentExpression? | LogicalExpression? | MemberExpression? | ConditionalExpression? | SimpleCallExpression? | NewExpression? | SequenceExpression? | TemplateLiteral? | TaggedTemplateExpression? | ClassExpression? | MetaProperty? | Identifier? | AwaitExpression? | ImportExpression? | ChainExpression? */ get() = definedExternally set(value) = definedExternally } -external interface ThrowStatement : BaseStatement { +internal external interface ThrowStatement : BaseStatement { override var type: String /* "ThrowStatement" */ var argument: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */ get() = definedExternally set(value) = definedExternally } -external interface TryStatement : BaseStatement { +internal external interface TryStatement : BaseStatement { override var type: String /* "TryStatement" */ var block: BlockStatement var handler: CatchClause? @@ -173,7 +168,7 @@ external interface TryStatement : BaseStatement { set(value) = definedExternally } -external interface WhileStatement : BaseStatement { +internal external interface WhileStatement : BaseStatement { override var type: String /* "WhileStatement" */ var test: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */ get() = definedExternally @@ -183,7 +178,7 @@ external interface WhileStatement : BaseStatement { set(value) = definedExternally } -external interface DoWhileStatement : BaseStatement { +internal external interface DoWhileStatement : BaseStatement { override var type: String /* "DoWhileStatement" */ var body: dynamic /* ExpressionStatement | BlockStatement | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | FunctionDeclaration | VariableDeclaration | ClassDeclaration */ get() = definedExternally @@ -193,7 +188,7 @@ external interface DoWhileStatement : BaseStatement { set(value) = definedExternally } -external interface ForStatement : BaseStatement { +internal external interface ForStatement : BaseStatement { override var type: String /* "ForStatement" */ var init: dynamic /* VariableDeclaration? | ThisExpression? | ArrayExpression? | ObjectExpression? | FunctionExpression? | ArrowFunctionExpression? | YieldExpression? | SimpleLiteral? | RegExpLiteral? | UnaryExpression? | UpdateExpression? | BinaryExpression? | AssignmentExpression? | LogicalExpression? | MemberExpression? | ConditionalExpression? | SimpleCallExpression? | NewExpression? | SequenceExpression? | TemplateLiteral? | TaggedTemplateExpression? | ClassExpression? | MetaProperty? | Identifier? | AwaitExpression? | ImportExpression? | ChainExpression? */ get() = definedExternally @@ -209,7 +204,7 @@ external interface ForStatement : BaseStatement { set(value) = definedExternally } -external interface BaseForXStatement : BaseStatement { +internal external interface BaseForXStatement : BaseStatement { var left: dynamic /* VariableDeclaration | Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression */ get() = definedExternally set(value) = definedExternally @@ -221,29 +216,29 @@ external interface BaseForXStatement : BaseStatement { set(value) = definedExternally } -external interface ForInStatement : BaseForXStatement { +internal external interface ForInStatement : BaseForXStatement { override var type: String /* "ForInStatement" */ } -external interface DebuggerStatement : BaseStatement { +internal external interface DebuggerStatement : BaseStatement { override var type: String /* "DebuggerStatement" */ } -external interface BaseDeclaration : BaseStatement +internal external interface BaseDeclaration : BaseStatement -external interface FunctionDeclaration : BaseFunction, BaseDeclaration { +internal external interface FunctionDeclaration : BaseFunction, BaseDeclaration { override var type: String /* "FunctionDeclaration" */ var id: Identifier? override var body: BlockStatement } -external interface VariableDeclaration : BaseDeclaration { +internal external interface VariableDeclaration : BaseDeclaration { override var type: String /* "VariableDeclaration" */ var declarations: Array var kind: String /* "var" | "let" | "const" */ } -external interface VariableDeclarator : BaseNode { +internal external interface VariableDeclarator : BaseNode { override var type: String /* "VariableDeclarator" */ var id: dynamic /* Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression */ get() = definedExternally @@ -253,30 +248,30 @@ external interface VariableDeclarator : BaseNode { set(value) = definedExternally } -external interface BaseExpression : BaseNode +internal external interface BaseExpression : BaseNode -external interface ChainExpression : BaseExpression { +internal external interface ChainExpression : BaseExpression { override var type: String /* "ChainExpression" */ var expression: dynamic /* SimpleCallExpression | MemberExpression */ get() = definedExternally set(value) = definedExternally } -external interface ThisExpression : BaseExpression { +internal external interface ThisExpression : BaseExpression { override var type: String /* "ThisExpression" */ } -external interface ArrayExpression : BaseExpression { +internal external interface ArrayExpression : BaseExpression { override var type: String /* "ArrayExpression" */ var elements: Array } -external interface ObjectExpression : BaseExpression { +internal external interface ObjectExpression : BaseExpression { override var type: String /* "ObjectExpression" */ var properties: Array } -external interface Property : BaseNode { +internal external interface Property : BaseNode { override var type: String /* "Property" */ var key: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */ get() = definedExternally @@ -290,7 +285,7 @@ external interface Property : BaseNode { var computed: Boolean } -external interface FunctionExpression : BaseFunction, BaseExpression { +internal external interface FunctionExpression : BaseFunction, BaseExpression { var id: Identifier? get() = definedExternally set(value) = definedExternally @@ -298,12 +293,12 @@ external interface FunctionExpression : BaseFunction, BaseExpression { override var body: BlockStatement } -external interface SequenceExpression : BaseExpression { +internal external interface SequenceExpression : BaseExpression { override var type: String /* "SequenceExpression" */ var expressions: Array } -external interface UnaryExpression : BaseExpression { +internal external interface UnaryExpression : BaseExpression { override var type: String /* "UnaryExpression" */ var operator: String /* "-" | "+" | "!" | "~" | "typeof" | "void" | "delete" */ var prefix: Boolean @@ -312,7 +307,7 @@ external interface UnaryExpression : BaseExpression { set(value) = definedExternally } -external interface BinaryExpression : BaseExpression { +internal external interface BinaryExpression : BaseExpression { override var type: String /* "BinaryExpression" */ var operator: String /* "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "|" | "^" | "&" | "in" | "instanceof" */ var left: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */ @@ -323,7 +318,7 @@ external interface BinaryExpression : BaseExpression { set(value) = definedExternally } -external interface AssignmentExpression : BaseExpression { +internal external interface AssignmentExpression : BaseExpression { override var type: String /* "AssignmentExpression" */ var operator: String /* "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" */ var left: dynamic /* Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression */ @@ -334,7 +329,7 @@ external interface AssignmentExpression : BaseExpression { set(value) = definedExternally } -external interface UpdateExpression : BaseExpression { +internal external interface UpdateExpression : BaseExpression { override var type: String /* "UpdateExpression" */ var operator: String /* "++" | "--" */ var argument: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */ @@ -343,7 +338,7 @@ external interface UpdateExpression : BaseExpression { var prefix: Boolean } -external interface LogicalExpression : BaseExpression { +internal external interface LogicalExpression : BaseExpression { override var type: String /* "LogicalExpression" */ var operator: String /* "||" | "&&" | "??" */ var left: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */ @@ -354,7 +349,7 @@ external interface LogicalExpression : BaseExpression { set(value) = definedExternally } -external interface ConditionalExpression : BaseExpression { +internal external interface ConditionalExpression : BaseExpression { override var type: String /* "ConditionalExpression" */ var test: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */ get() = definedExternally @@ -367,23 +362,23 @@ external interface ConditionalExpression : BaseExpression { set(value) = definedExternally } -external interface BaseCallExpression : BaseExpression { +internal external interface BaseCallExpression : BaseExpression { var callee: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression | Super */ get() = definedExternally set(value) = definedExternally var arguments: Array } -external interface SimpleCallExpression : BaseCallExpression { +internal external interface SimpleCallExpression : BaseCallExpression { override var type: String /* "CallExpression" */ var optional: Boolean } -external interface NewExpression : BaseCallExpression { +internal external interface NewExpression : BaseCallExpression { override var type: String /* "NewExpression" */ } -external interface MemberExpression : BaseExpression, BasePattern { +internal external interface MemberExpression : BaseExpression, BasePattern { override var type: String /* "MemberExpression" */ var `object`: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression | Super */ get() = definedExternally @@ -395,9 +390,9 @@ external interface MemberExpression : BaseExpression, BasePattern { var optional: Boolean } -external interface BasePattern : BaseNode +internal external interface BasePattern : BaseNode -external interface SwitchCase : BaseNode { +internal external interface SwitchCase : BaseNode { override var type: String /* "SwitchCase" */ var test: dynamic /* ThisExpression? | ArrayExpression? | ObjectExpression? | FunctionExpression? | ArrowFunctionExpression? | YieldExpression? | SimpleLiteral? | RegExpLiteral? | UnaryExpression? | UpdateExpression? | BinaryExpression? | AssignmentExpression? | LogicalExpression? | MemberExpression? | ConditionalExpression? | SimpleCallExpression? | NewExpression? | SequenceExpression? | TemplateLiteral? | TaggedTemplateExpression? | ClassExpression? | MetaProperty? | Identifier? | AwaitExpression? | ImportExpression? | ChainExpression? */ get() = definedExternally @@ -405,7 +400,7 @@ external interface SwitchCase : BaseNode { var consequent: Array } -external interface CatchClause : BaseNode { +internal external interface CatchClause : BaseNode { override var type: String /* "CatchClause" */ var param: dynamic /* Identifier? | ObjectPattern? | ArrayPattern? | RestElement? | AssignmentPattern? | MemberExpression? */ get() = definedExternally @@ -413,12 +408,12 @@ external interface CatchClause : BaseNode { var body: BlockStatement } -external interface Identifier : BaseNode, BaseExpression, BasePattern { +internal external interface Identifier : BaseNode, BaseExpression, BasePattern { override var type: String /* "Identifier" */ var name: String } -external interface SimpleLiteral : BaseNode, BaseExpression { +internal external interface SimpleLiteral : BaseNode, BaseExpression { override var type: String /* "Literal" */ var value: dynamic /* String? | Boolean? | Number? */ get() = definedExternally @@ -428,12 +423,12 @@ external interface SimpleLiteral : BaseNode, BaseExpression { set(value) = definedExternally } -external interface `T$1` { +internal external interface `T$1` { var pattern: String var flags: String } -external interface RegExpLiteral : BaseNode, BaseExpression { +internal external interface RegExpLiteral : BaseNode, BaseExpression { override var type: String /* "Literal" */ var value: RegExp? get() = definedExternally @@ -444,23 +439,23 @@ external interface RegExpLiteral : BaseNode, BaseExpression { set(value) = definedExternally } -external interface ForOfStatement : BaseForXStatement { +internal external interface ForOfStatement : BaseForXStatement { override var type: String /* "ForOfStatement" */ var await: Boolean } -external interface Super : BaseNode { +internal external interface Super : BaseNode { override var type: String /* "Super" */ } -external interface SpreadElement : BaseNode { +internal external interface SpreadElement : BaseNode { override var type: String /* "SpreadElement" */ var argument: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */ get() = definedExternally set(value) = definedExternally } -external interface ArrowFunctionExpression : BaseExpression, BaseFunction { +internal external interface ArrowFunctionExpression : BaseExpression, BaseFunction { override var type: String /* "ArrowFunctionExpression" */ var expression: Boolean override var body: dynamic /* BlockStatement | ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */ @@ -468,7 +463,7 @@ external interface ArrowFunctionExpression : BaseExpression, BaseFunction { set(value) = definedExternally } -external interface YieldExpression : BaseExpression { +internal external interface YieldExpression : BaseExpression { override var type: String /* "YieldExpression" */ var argument: dynamic /* ThisExpression? | ArrayExpression? | ObjectExpression? | FunctionExpression? | ArrowFunctionExpression? | YieldExpression? | SimpleLiteral? | RegExpLiteral? | UnaryExpression? | UpdateExpression? | BinaryExpression? | AssignmentExpression? | LogicalExpression? | MemberExpression? | ConditionalExpression? | SimpleCallExpression? | NewExpression? | SequenceExpression? | TemplateLiteral? | TaggedTemplateExpression? | ClassExpression? | MetaProperty? | Identifier? | AwaitExpression? | ImportExpression? | ChainExpression? */ get() = definedExternally @@ -476,13 +471,13 @@ external interface YieldExpression : BaseExpression { var delegate: Boolean } -external interface TemplateLiteral : BaseExpression { +internal external interface TemplateLiteral : BaseExpression { override var type: String /* "TemplateLiteral" */ var quasis: Array var expressions: Array } -external interface TaggedTemplateExpression : BaseExpression { +internal external interface TaggedTemplateExpression : BaseExpression { override var type: String /* "TaggedTemplateExpression" */ var tag: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */ get() = definedExternally @@ -490,18 +485,18 @@ external interface TaggedTemplateExpression : BaseExpression { var quasi: TemplateLiteral } -external interface `T$2` { +internal external interface `T$2` { var cooked: String var raw: String } -external interface TemplateElement : BaseNode { +internal external interface TemplateElement : BaseNode { override var type: String /* "TemplateElement" */ var tail: Boolean var value: `T$2` } -external interface AssignmentProperty : Property { +internal external interface AssignmentProperty : Property { override var value: dynamic /* Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression */ get() = definedExternally set(value) = definedExternally @@ -509,24 +504,24 @@ external interface AssignmentProperty : Property { override var method: Boolean } -external interface ObjectPattern : BasePattern { +internal external interface ObjectPattern : BasePattern { override var type: String /* "ObjectPattern" */ var properties: Array } -external interface ArrayPattern : BasePattern { +internal external interface ArrayPattern : BasePattern { override var type: String /* "ArrayPattern" */ var elements: Array } -external interface RestElement : BasePattern { +internal external interface RestElement : BasePattern { override var type: String /* "RestElement" */ var argument: dynamic /* Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression */ get() = definedExternally set(value) = definedExternally } -external interface AssignmentPattern : BasePattern { +internal external interface AssignmentPattern : BasePattern { override var type: String /* "AssignmentPattern" */ var left: dynamic /* Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression */ get() = definedExternally @@ -536,19 +531,19 @@ external interface AssignmentPattern : BasePattern { set(value) = definedExternally } -external interface BaseClass : BaseNode { +internal external interface BaseClass : BaseNode { var superClass: dynamic /* ThisExpression? | ArrayExpression? | ObjectExpression? | FunctionExpression? | ArrowFunctionExpression? | YieldExpression? | SimpleLiteral? | RegExpLiteral? | UnaryExpression? | UpdateExpression? | BinaryExpression? | AssignmentExpression? | LogicalExpression? | MemberExpression? | ConditionalExpression? | SimpleCallExpression? | NewExpression? | SequenceExpression? | TemplateLiteral? | TaggedTemplateExpression? | ClassExpression? | MetaProperty? | Identifier? | AwaitExpression? | ImportExpression? | ChainExpression? */ get() = definedExternally set(value) = definedExternally var body: ClassBody } -external interface ClassBody : BaseNode { +internal external interface ClassBody : BaseNode { override var type: String /* "ClassBody" */ var body: Array } -external interface MethodDefinition : BaseNode { +internal external interface MethodDefinition : BaseNode { override var type: String /* "MethodDefinition" */ var key: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */ get() = definedExternally @@ -559,31 +554,31 @@ external interface MethodDefinition : BaseNode { var static: Boolean } -external interface ClassDeclaration : BaseClass, BaseDeclaration { +internal external interface ClassDeclaration : BaseClass, BaseDeclaration { override var type: String /* "ClassDeclaration" */ var id: Identifier? } -external interface ClassExpression : BaseClass, BaseExpression { +internal external interface ClassExpression : BaseClass, BaseExpression { override var type: String /* "ClassExpression" */ var id: Identifier? get() = definedExternally set(value) = definedExternally } -external interface MetaProperty : BaseExpression { +internal external interface MetaProperty : BaseExpression { override var type: String /* "MetaProperty" */ var meta: Identifier var property: Identifier } -external interface BaseModuleDeclaration : BaseNode +internal external interface BaseModuleDeclaration : BaseNode -external interface BaseModuleSpecifier : BaseNode { +internal external interface BaseModuleSpecifier : BaseNode { var local: Identifier } -external interface ImportDeclaration : BaseModuleDeclaration { +internal external interface ImportDeclaration : BaseModuleDeclaration { override var type: String /* "ImportDeclaration" */ var specifiers: Array var source: dynamic /* SimpleLiteral | RegExpLiteral */ @@ -591,27 +586,27 @@ external interface ImportDeclaration : BaseModuleDeclaration { set(value) = definedExternally } -external interface ImportSpecifier : BaseModuleSpecifier { +internal external interface ImportSpecifier : BaseModuleSpecifier { override var type: String /* "ImportSpecifier" */ var imported: Identifier } -external interface ImportExpression : BaseExpression { +internal external interface ImportExpression : BaseExpression { override var type: String /* "ImportExpression" */ var source: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */ get() = definedExternally set(value) = definedExternally } -external interface ImportDefaultSpecifier : BaseModuleSpecifier { +internal external interface ImportDefaultSpecifier : BaseModuleSpecifier { override var type: String /* "ImportDefaultSpecifier" */ } -external interface ImportNamespaceSpecifier : BaseModuleSpecifier { +internal external interface ImportNamespaceSpecifier : BaseModuleSpecifier { override var type: String /* "ImportNamespaceSpecifier" */ } -external interface ExportNamedDeclaration : BaseModuleDeclaration { +internal external interface ExportNamedDeclaration : BaseModuleDeclaration { override var type: String /* "ExportNamedDeclaration" */ var declaration: dynamic /* FunctionDeclaration? | VariableDeclaration? | ClassDeclaration? */ get() = definedExternally @@ -622,28 +617,28 @@ external interface ExportNamedDeclaration : BaseModuleDeclaration { set(value) = definedExternally } -external interface ExportSpecifier : BaseModuleSpecifier { +internal external interface ExportSpecifier : BaseModuleSpecifier { override var type: String /* "ExportSpecifier" */ var exported: Identifier } -external interface ExportDefaultDeclaration : BaseModuleDeclaration { +internal external interface ExportDefaultDeclaration : BaseModuleDeclaration { override var type: String /* "ExportDefaultDeclaration" */ var declaration: dynamic /* FunctionDeclaration | VariableDeclaration | ClassDeclaration | ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */ get() = definedExternally set(value) = definedExternally } -external interface ExportAllDeclaration : BaseModuleDeclaration { +internal external interface ExportAllDeclaration : BaseModuleDeclaration { override var type: String /* "ExportAllDeclaration" */ var source: dynamic /* SimpleLiteral | RegExpLiteral */ get() = definedExternally set(value) = definedExternally } -external interface AwaitExpression : BaseExpression { +internal external interface AwaitExpression : BaseExpression { override var type: String /* "AwaitExpression" */ var argument: dynamic /* ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | ArrowFunctionExpression | YieldExpression | SimpleLiteral | RegExpLiteral | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | SimpleCallExpression | NewExpression | SequenceExpression | TemplateLiteral | TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier | AwaitExpression | ImportExpression | ChainExpression */ get() = definedExternally set(value) = definedExternally -} \ No newline at end of file +} diff --git a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/stream/stream.kt b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/stream/stream.kt new file mode 100644 index 000000000..b3c65a758 --- /dev/null +++ b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/stream/stream.kt @@ -0,0 +1,7 @@ +package kscience.kmath.estree.internal.stream + +import kscience.kmath.estree.internal.emitter.Emitter + +internal open external class Stream : Emitter { + open fun pipe(dest: Any, options: Any): Any +} diff --git a/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/tsstdlib/lib.es2015.iterable.kt b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/tsstdlib/lib.es2015.iterable.kt new file mode 100644 index 000000000..22d4dd8e0 --- /dev/null +++ b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/tsstdlib/lib.es2015.iterable.kt @@ -0,0 +1,25 @@ +package kscience.kmath.estree.internal.tsstdlib + +internal external interface IteratorYieldResult { + var done: Boolean? + get() = definedExternally + set(value) = definedExternally + var value: TYield +} + +internal external interface IteratorReturnResult { + var done: Boolean + var value: TReturn +} + +internal external interface Iterator { + fun next(vararg args: Any /* JsTuple<> | JsTuple */): dynamic /* IteratorYieldResult | IteratorReturnResult */ + val `return`: ((value: TReturn) -> dynamic)? + val `throw`: ((e: Any) -> dynamic)? +} + +internal typealias Iterator__1 = Iterator + +internal external interface Iterable + +internal external interface IterableIterator : Iterator__1 diff --git a/kmath-ast/src/jsMain/kotlin/lib.es5.kt b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/tsstdlib/lib.es5.kt similarity index 77% rename from kmath-ast/src/jsMain/kotlin/lib.es5.kt rename to kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/tsstdlib/lib.es5.kt index fe3847232..70f6d9702 100644 --- a/kmath-ast/src/jsMain/kotlin/lib.es5.kt +++ b/kmath-ast/src/jsMain/kotlin/kscience/kmath/estree/internal/tsstdlib/lib.es5.kt @@ -1,18 +1,14 @@ -@file:Suppress( - "INTERFACE_WITH_SUPERCLASS", "OVERRIDING_FINAL_MEMBER", "RETURN_TYPE_MISMATCH_ON_OVERRIDE", "CONFLICTING_OVERLOADS", - "NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING", "DEPRECATION", "PackageDirectoryMismatch", "KDocMissingDocumentation", - "PropertyName" -) +@file:Suppress("UNUSED_TYPEALIAS_PARAMETER", "DEPRECATION") -package tsstdlib +package kscience.kmath.estree.internal.tsstdlib import kotlin.js.RegExp -typealias RegExpMatchArray = Array +internal typealias RegExpMatchArray = Array -typealias RegExpExecArray = Array +internal typealias RegExpExecArray = Array -external interface RegExpConstructor { +internal external interface RegExpConstructor { @nativeInvoke operator fun invoke(pattern: RegExp, flags: String = definedExternally): RegExp @@ -37,7 +33,7 @@ external interface RegExpConstructor { var lastMatch: String } -external interface ConcatArray { +internal external interface ConcatArray { var length: Number @nativeGetter @@ -49,7 +45,7 @@ external interface ConcatArray { fun slice(start: Number = definedExternally, end: Number = definedExternally): Array } -external interface ArrayConstructor { +internal external interface ArrayConstructor { fun from(iterable: Iterable): Array fun from(iterable: ArrayLike): Array fun from(iterable: Iterable, mapfn: (v: T, k: Number) -> U, thisArg: Any = definedExternally): Array @@ -73,7 +69,7 @@ external interface ArrayConstructor { var prototype: Array } -external interface ArrayLike { +internal external interface ArrayLike { var length: Number @nativeGetter @@ -83,4 +79,4 @@ external interface ArrayLike { operator fun set(n: Number, value: T) } -typealias Extract = Any \ No newline at end of file +internal typealias Extract = Any diff --git a/kmath-ast/src/jsMain/kotlin/lib.es2015.iterable.kt b/kmath-ast/src/jsMain/kotlin/lib.es2015.iterable.kt deleted file mode 100644 index b55785a8e..000000000 --- a/kmath-ast/src/jsMain/kotlin/lib.es2015.iterable.kt +++ /dev/null @@ -1,28 +0,0 @@ -@file:Suppress("INTERFACE_WITH_SUPERCLASS", "OVERRIDING_FINAL_MEMBER", "RETURN_TYPE_MISMATCH_ON_OVERRIDE", "CONFLICTING_OVERLOADS", - "NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING", "KDocMissingDocumentation", "PackageDirectoryMismatch" -) -package tsstdlib - -external interface IteratorYieldResult { - var done: Boolean? - get() = definedExternally - set(value) = definedExternally - var value: TYield -} - -external interface IteratorReturnResult { - var done: Boolean - var value: TReturn -} - -external interface Iterator { - fun next(vararg args: Any /* JsTuple<> | JsTuple */): dynamic /* IteratorYieldResult | IteratorReturnResult */ - val `return`: ((value: TReturn) -> dynamic)? - val `throw`: ((e: Any) -> dynamic)? -} - -typealias Iterator__1 = Iterator - -external interface Iterable - -external interface IterableIterator : Iterator__1 \ No newline at end of file diff --git a/kmath-ast/src/jsMain/kotlin/stream.kt b/kmath-ast/src/jsMain/kotlin/stream.kt deleted file mode 100644 index c6c30446c..000000000 --- a/kmath-ast/src/jsMain/kotlin/stream.kt +++ /dev/null @@ -1,13 +0,0 @@ -@file:Suppress( - "INTERFACE_WITH_SUPERCLASS", "OVERRIDING_FINAL_MEMBER", "RETURN_TYPE_MISMATCH_ON_OVERRIDE", "CONFLICTING_OVERLOADS", - "NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING", "NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING", "SortModifiers", - "KDocMissingDocumentation", "PackageDirectoryMismatch" -) - -package stream - -import emitter.Emitter - -external open class Stream : Emitter { - open fun pipe(dest: Any, options: Any): Any -} \ No newline at end of file