Skip to content

Commit

Permalink
update nextls
Browse files Browse the repository at this point in the history
  • Loading branch information
mkideal committed Oct 14, 2024
1 parent c738d7d commit 2e70ee6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmd/nextls/internal/handler/next/next.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ func addTypeTokens(v *tokenVisiter, x compile.Type) {
case *compile.ArrayType:
addToken(&v.tokens, v.doc, token.ARRAY.String(), node.Pos(), protocol.TokenTypeType)
addTypeTokens(v, t2.ElemType)
ast.Walk(v, compile.LenExpr(t2))
case *compile.VectorType:
addToken(&v.tokens, v.doc, token.VECTOR.String(), node.Pos(), protocol.TokenTypeType)
addTypeTokens(v, t2.ElemType)
Expand Down
1 change: 1 addition & 0 deletions src/compile/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ func (c *Compiler) resolveArrayType(depth int, node Node, t *ast.ArrayType, igno
pos: t.Pos(),
ElemType: typ,
N: c.resolveInt64(node.File(), t.N),
lenExpr: t.N,
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/compile/next.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func Compile(platform Platform, builtin FileSystem, args []string) {
name := flagSet.Name()
term.Fprint(flagSet.Output(), "Next is an IDL for generating customized code across multiple languages.\n\n")
term.Fprint(flagSet.Output(), "Usage:\n\n")
term.Fprintf(flagSet.Output(), " %s [Options] [source_dirs_or_files...] (default: current directory)\n", name)
term.Fprintf(flagSet.Output(), " %s [Options] [source_dirs_or_files...]\n", name)
term.Fprintf(flagSet.Output(), " %s [Options] <stdin>\n", name)
term.Fprintf(flagSet.Output(), " %s <Command> ...\n", name)
term.Fprintf(flagSet.Output(), "\nCommands:\n\n")
Expand Down
5 changes: 4 additions & 1 deletion src/compile/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,8 @@ var primitiveTypes = func() map[string]*PrimitiveType {

// @api(Object/ArrayType) represents an fixed-size array [Type](#Object/Common/Type).
type ArrayType struct {
pos token.Pos
pos token.Pos
lenExpr ast.Expr

// @api(Object/ArrayType.ElemType) represents the element [Type](#Object/Common/Type) of the array.
ElemType Type
Expand All @@ -822,6 +823,8 @@ type ArrayType struct {
N int64
}

func LenExpr(a *ArrayType) ast.Expr { return a.lenExpr }

func (a *ArrayType) String() string {
return "array<" + a.ElemType.String() + "," + strconv.FormatInt(a.N, 10) + ">"
}
Expand Down

0 comments on commit 2e70ee6

Please sign in to comment.