transpiler

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Copyright 2025 The Hulo Authors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MangleModule

func MangleModule(module *Module) error

func ResolveAllDependencies

func ResolveAllDependencies(resolver *DependecyResolver, mainFile string) error

从 main 入口开始解析

Types

type Cycles

type Cycles struct{}

type DependecyResolver

type DependecyResolver struct {
	// contains filtered or unexported fields
}

func NewDependecyResolver

func NewDependecyResolver() *DependecyResolver

type ExportInfo

type ExportInfo struct{}

type ImportInfo

type ImportInfo struct {
	ModulePath string
	SymbolName []string
	Alias      string
	Kind       ImportKind
}

type ImportKind

type ImportKind int
const (
	ImportSingle ImportKind = iota
	ImportMulti
	ImportAll
)

type Module

type Module struct {
	Name         string // 模块名,要处理别名的情况 import "time" as t
	Path         string // 模块绝对路径
	AST          *hast.File
	Exports      map[string]*ExportInfo
	Imports      []*ImportInfo
	Dependencies []string
	Transpiled   *bast.File
	Symbols      *SymbolTable
	State        ModuleState
	Pkg          *config.HuloPkg
}

func (*Module) IsMangled

func (m *Module) IsMangled() bool

func (*Module) ResolveImportedSymbols

func (m *Module) ResolveImportedSymbols(key string) error

在 main 模块下 查询他的依赖 utils_calculate, add, m_add

type ModuleState

type ModuleState int
const (
	ModuleStateUnresolved ModuleState = iota
	ModuleStateResolved
	ModuleStateMangled
)

type SymbolTable

type SymbolTable struct{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL