Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions internal/pure/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,20 @@ outer:
_ = getBB(typ.PR.Begin.FileName(), typ.PR.Begin.FileContent())
}
for _, f := range k.filesTL1 {
for _, typ := range f.Combinators() {
bb := getBB(typ.PR.Begin.FileName(), "")
bb := getBB(f.FileName, "")
for _, cs := range f.CS {
if cs.C == nil {
bb.WriteString(cs.S.String())
continue
}
typ := cs.C
//bb.WriteString(typ.SectionPR.Begin.FileContent()[typ.SectionPR.Begin.Offset():typ.SectionPR.End.Offset()])
if _, ok := migrateNames[typ.Construct.Name]; !ok {
bb.WriteString(typ.AllPR.Begin.FileContent()[typ.AllPR.Begin.Offset():typ.AllPR.End.Offset()])
continue
}
}
bb.WriteString(f.CommentAfter)
}
// check there will be no references to TL2 combinators from TL1 combinators
refErrList, err := k.findTL1toTL2References(migrateTips)
Expand Down
8 changes: 8 additions & 0 deletions internal/tlast/tlparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,20 @@ type Section struct {
IsFunctions bool // otherwise, types
}

func (s Section) String() string {
if s.IsFunctions {
return s.CommentBefore + "---functions---"
}
return s.CommentBefore + "---types---"
}

type CombinatorOrSection struct {
C *Combinator // if !nil, this is combinator
S Section // otherwise section
}

type TL struct {
FileName string
CS []CombinatorOrSection
CommentAfter string
}
Expand Down
2 changes: 1 addition & 1 deletion internal/tlast/tlparser_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ func ParseTLFile(str, file string, opts LexerOptions) (*TL, error) {
}

functionSection := false
res := &TL{}
res := &TL{FileName: file}

orderIndex := 0
rest := tokenIterator{tokens: allTokens}
Expand Down
Loading