Skip to content

Commit

Permalink
[tools:doc] Add separator field to MethodDoc to indicate instance v…
Browse files Browse the repository at this point in the history
…s static methods.
  • Loading branch information
faultyserver committed Apr 14, 2018
1 parent 79fc005 commit 4a1ecff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/myst/tools/doc.cr
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ module Myst
raise "Unhandled DocContext type #{typeof(context)}."
end

is_instance = container.is_a?(TypeDoc) && !node.static?
# Make sure that a method entry for this clause exists.
container[node.name] ||= MethodDoc.new(node.name, make_full_path(node.name), nil)
container[node.name] ||= MethodDoc.new(node.name, make_full_path(node.name), is_instance ? "#" : ".", nil)
method_doc = container[node.name]

clause_doc = ClauseDoc.new(
Expand Down
4 changes: 3 additions & 1 deletion src/myst/tools/doc/method_doc.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ module Myst
property kind = Kind::METHOD
property name : String
property full_name : String
property separator : String
property clauses = [] of ClauseDoc
property doc : String? = nil

JSON.mapping(
kind: Kind,
name: String,
full_name: String,
separator: String,
clauses: Array(ClauseDoc),
doc: {type: String?, emit_null: true}
)


def initialize(@name : String, @full_name : String, @doc : String?)
def initialize(@name : String, @full_name : String, @separator : String, @doc : String?)
end
end
end
Expand Down

0 comments on commit 4a1ecff

Please sign in to comment.