Skip to content

Commit bc6ff93

Browse files
committed
docs: update readme
1 parent 8e42252 commit bc6ff93

3 files changed

Lines changed: 9 additions & 17 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ A Lua 5.3 Lexer & Parser written in pure Kotlin.
1616
- Add the dependency to your gradle file
1717

1818
```kotlin
19-
implementation("io.github.dingyi222666:luaparser:1.0.1")
19+
implementation("io.github.dingyi222666:luaparser:1.0.2")
2020
```
2121

2222
Ok. Use it like this:

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ plugins {
1010
}
1111

1212
group = "io.github.dingyi222666"
13-
version = "1.0.0"
13+
version = "1.0.2"
1414

1515
kotlin {
1616
jvm {
@@ -85,7 +85,7 @@ mavenPublishing {
8585

8686
signAllPublications()
8787

88-
coordinates("io.github.dingyi222666", "luaparser", "1.0.1")
88+
coordinates("io.github.dingyi222666", "luaparser", "1.0.2")
8989

9090
pom {
9191
name.set("luaparser")

src/commonMain/kotlin/io/github/dingyi222666/luaparser/semantic/SemanticAnalyzer.kt

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@ class SemanticAnalyzer : ASTVisitor<BaseASTNode> {
1616

1717
private val globalScope = GlobalScope(range = Range.EMPTY)
1818

19-
private fun createLocalScope(node: BaseASTNode): LocalScope {
20-
val parent = currentScope
21-
val localScope = LocalScope(parent, node.range)
22-
scopeStack.addFirst(localScope)
23-
globalScope.addScope(localScope)
24-
return localScope
25-
}
26-
2719
private fun createFunctionScope(node: BaseASTNode): FunctionScope {
2820
val parent = currentScope
2921
val localScope = FunctionScope(parent, node.range)
@@ -146,15 +138,15 @@ class SemanticAnalyzer : ASTVisitor<BaseASTNode> {
146138
is Identifier -> setIdentifierType(
147139
value,
148140

149-
resolveExpressionNodeType(node, currentScope) ?: Type.ANY, currentScope
141+
resolveExpressionNodeType(node, currentScope), currentScope
150142
)
151143

152144
is MemberExpression -> setMemberExpressionType(
153-
value, resolveExpressionNodeType(node, currentScope) ?: Type.ANY, currentScope
145+
value, resolveExpressionNodeType(node, currentScope), currentScope
154146
)
155147

156148
is ReturnStatement -> setReturnStatementType(
157-
value, node, resolveExpressionNodeType(node, currentScope) ?: Type.ANY, currentScope
149+
value, node, resolveExpressionNodeType(node, currentScope), currentScope
158150
)
159151
}
160152
}
@@ -211,7 +203,7 @@ class SemanticAnalyzer : ASTVisitor<BaseASTNode> {
211203

212204
// return: return a
213205
is ReturnStatement -> setReturnStatementType(
214-
value, node, resolveExpressionNodeType(node) ?: Type.ANY, currentScope
206+
value, node, resolveExpressionNodeType(node), currentScope
215207
)
216208
}
217209
}
@@ -469,12 +461,12 @@ class SemanticAnalyzer : ASTVisitor<BaseASTNode> {
469461

470462
if (value is TableConstructorExpression) {
471463
val valueType = TableType(TypeKind.Table, keyValue.toString())
472-
currentType.setMember(keyValue.toString(), keyType ?: Type.ANY, valueType)
464+
currentType.setMember(keyValue.toString(), keyType, valueType)
473465
tableConstructorStack.addLast(value to valueType)
474466
currentType = valueType
475467
} else {
476468
val valueType = resolveExpressionNodeType(value, scope)
477-
currentType.setMember(keyValue.toString(), keyType ?: Type.ANY, valueType)
469+
currentType.setMember(keyValue.toString(), keyType, valueType)
478470
}
479471

480472
}

0 commit comments

Comments
 (0)