reducing ast dependencies

This commit is contained in:
Irmen de Jong 2021-02-07 06:49:51 +01:00
parent e35b739579
commit 02fae0e722
23 changed files with 40 additions and 25 deletions

View File

@ -5,7 +5,7 @@ import prog8.ast.base.DataType
import prog8.ast.base.NumericDatatypes
import prog8.ast.base.VarDeclType
import prog8.ast.expressions.*
import prog8.ast.processing.IAstVisitor
import prog8.ast.walk.IAstVisitor
import prog8.ast.statements.*

View File

@ -3,9 +3,9 @@ package prog8.ast
import prog8.ast.base.*
import prog8.ast.expressions.Expression
import prog8.ast.expressions.IdentifierReference
import prog8.ast.processing.AstWalker
import prog8.ast.processing.IAstVisitor
import prog8.ast.walk.IAstVisitor
import prog8.ast.statements.*
import prog8.ast.walk.AstWalker
import prog8.functions.BuiltinFunctions
import java.nio.file.Path
import kotlin.math.abs

View File

@ -3,9 +3,9 @@ package prog8.ast.expressions
import prog8.ast.*
import prog8.ast.antlr.escape
import prog8.ast.base.*
import prog8.ast.processing.AstWalker
import prog8.ast.processing.IAstVisitor
import prog8.ast.walk.IAstVisitor
import prog8.ast.statements.*
import prog8.ast.walk.AstWalker
import prog8.functions.BuiltinFunctions
import prog8.functions.CannotEvaluateException
import prog8.functions.NotConstArgumentException

View File

@ -6,6 +6,7 @@ import prog8.ast.Program
import prog8.ast.base.*
import prog8.ast.expressions.*
import prog8.ast.statements.*
import prog8.ast.walk.IAstVisitor
import prog8.compiler.CompilationOptions
import prog8.compiler.target.C64Target
import prog8.compiler.target.CompilationTarget

View File

@ -5,6 +5,7 @@ import prog8.ast.Program
import prog8.ast.base.*
import prog8.ast.expressions.*
import prog8.ast.statements.*
import prog8.ast.walk.IAstVisitor
import prog8.compiler.target.CompilationTarget
import prog8.functions.BuiltinFunctions

View File

@ -5,6 +5,8 @@ import prog8.ast.Program
import prog8.ast.base.*
import prog8.ast.expressions.*
import prog8.ast.statements.*
import prog8.ast.walk.AstWalker
import prog8.ast.walk.IAstModification
internal class AstVariousTransforms(private val program: Program) : AstWalker() {

View File

@ -3,6 +3,8 @@ package prog8.ast.processing
import prog8.ast.INameScope
import prog8.ast.Node
import prog8.ast.statements.Directive
import prog8.ast.walk.AstWalker
import prog8.ast.walk.IAstModification
internal class ImportedModuleDirectiveRemover: AstWalker() {

View File

@ -5,6 +5,8 @@ import prog8.ast.Program
import prog8.ast.base.*
import prog8.ast.expressions.*
import prog8.ast.statements.*
import prog8.ast.walk.AstWalker
import prog8.ast.walk.IAstModification
internal class LiteralsToAutoVars(private val program: Program) : AstWalker() {

View File

@ -5,6 +5,8 @@ import prog8.ast.base.*
import prog8.ast.expressions.*
import prog8.ast.statements.*
import prog8.functions.BuiltinFunctions
import prog8.ast.walk.AstWalker
import prog8.ast.walk.IAstModification
internal class StatementReorderer(val program: Program, val errors: ErrorReporter) : AstWalker() {

View File

@ -8,6 +8,8 @@ import prog8.ast.base.*
import prog8.ast.expressions.*
import prog8.ast.statements.*
import prog8.functions.BuiltinFunctions
import prog8.ast.walk.AstWalker
import prog8.ast.walk.IAstModification
class TypecastsAdder(val program: Program, val errors: ErrorReporter) : AstWalker() {

View File

@ -6,6 +6,8 @@ import prog8.ast.expressions.NumericLiteralValue
import prog8.ast.expressions.TypecastExpression
import prog8.ast.statements.AnonymousScope
import prog8.ast.statements.NopStatement
import prog8.ast.walk.AstWalker
import prog8.ast.walk.IAstModification
internal class VariousCleanups: AstWalker() {

View File

@ -8,6 +8,7 @@ import prog8.ast.expressions.Expression
import prog8.ast.expressions.FunctionCall
import prog8.ast.expressions.TypecastExpression
import prog8.ast.statements.*
import prog8.ast.walk.IAstVisitor
import prog8.compiler.CompilerException
import prog8.functions.BuiltinFunctions

View File

@ -3,8 +3,8 @@ package prog8.ast.statements
import prog8.ast.*
import prog8.ast.base.*
import prog8.ast.expressions.*
import prog8.ast.processing.AstWalker
import prog8.ast.processing.IAstVisitor
import prog8.ast.walk.IAstVisitor
import prog8.ast.walk.AstWalker
sealed class Statement : Node {

View File

@ -1,4 +1,4 @@
package prog8.ast.processing
package prog8.ast.walk
import prog8.ast.*
import prog8.ast.base.FatalAstException

View File

@ -1,4 +1,4 @@
package prog8.ast.processing
package prog8.ast.walk
import prog8.ast.Module
import prog8.ast.Program

View File

@ -5,9 +5,9 @@ import prog8.ast.Node
import prog8.ast.Program
import prog8.ast.base.*
import prog8.ast.expressions.*
import prog8.ast.processing.AstWalker
import prog8.ast.processing.IAstModification
import prog8.ast.statements.*
import prog8.ast.walk.AstWalker
import prog8.ast.walk.IAstModification
import prog8.compiler.target.CompilationTarget

View File

@ -4,10 +4,10 @@ import prog8.ast.INameScope
import prog8.ast.Node
import prog8.ast.Program
import prog8.ast.expressions.*
import prog8.ast.processing.AstWalker
import prog8.ast.processing.IAstModification
import prog8.ast.statements.AssignTarget
import prog8.ast.statements.Assignment
import prog8.ast.walk.AstWalker
import prog8.ast.walk.IAstModification
import prog8.compiler.target.CompilationTarget

View File

@ -7,7 +7,7 @@ import prog8.ast.base.ParentSentinel
import prog8.ast.base.Position
import prog8.ast.expressions.FunctionCall
import prog8.ast.expressions.IdentifierReference
import prog8.ast.processing.IAstVisitor
import prog8.ast.walk.IAstVisitor
import prog8.ast.statements.*
import prog8.compiler.loadAsmIncludeFile

View File

@ -4,9 +4,9 @@ import prog8.ast.Node
import prog8.ast.Program
import prog8.ast.base.*
import prog8.ast.expressions.*
import prog8.ast.processing.AstWalker
import prog8.ast.processing.IAstModification
import prog8.ast.statements.*
import prog8.ast.walk.AstWalker
import prog8.ast.walk.IAstModification
import prog8.compiler.target.CompilationTarget
import kotlin.math.pow

View File

@ -4,12 +4,12 @@ import prog8.ast.Node
import prog8.ast.Program
import prog8.ast.base.*
import prog8.ast.expressions.*
import prog8.ast.processing.AstWalker
import prog8.ast.processing.IAstModification
import prog8.ast.statements.ArrayIndex
import prog8.ast.statements.AssignTarget
import prog8.ast.statements.ForLoop
import prog8.ast.statements.VarDecl
import prog8.ast.walk.AstWalker
import prog8.ast.walk.IAstModification
import prog8.compiler.target.CompilationTarget
// Fix up the literal value's type to match that of the vardecl

View File

@ -4,9 +4,9 @@ import prog8.ast.Node
import prog8.ast.Program
import prog8.ast.base.*
import prog8.ast.expressions.*
import prog8.ast.processing.AstWalker
import prog8.ast.processing.IAstModification
import prog8.ast.statements.Assignment
import prog8.ast.walk.AstWalker
import prog8.ast.walk.IAstModification
import kotlin.math.abs
import kotlin.math.log2
import kotlin.math.pow

View File

@ -5,10 +5,10 @@ import prog8.ast.Node
import prog8.ast.Program
import prog8.ast.base.*
import prog8.ast.expressions.*
import prog8.ast.processing.AstWalker
import prog8.ast.processing.IAstModification
import prog8.ast.processing.IAstVisitor
import prog8.ast.walk.IAstVisitor
import prog8.ast.statements.*
import prog8.ast.walk.AstWalker
import prog8.ast.walk.IAstModification
import prog8.compiler.target.CompilationTarget
import prog8.functions.BuiltinFunctions
import kotlin.math.floor

View File

@ -5,9 +5,9 @@ import prog8.ast.Node
import prog8.ast.Program
import prog8.ast.base.ErrorReporter
import prog8.ast.expressions.*
import prog8.ast.processing.AstWalker
import prog8.ast.processing.IAstModification
import prog8.ast.statements.*
import prog8.ast.walk.AstWalker
import prog8.ast.walk.IAstModification
import prog8.compiler.target.CompilationTarget