Skip to content

Commit

Permalink
For [GH #161] - WIP - Spec2Types
Browse files Browse the repository at this point in the history
  • Loading branch information
hkoba committed Mar 23, 2019
1 parent a2952a4 commit a8e571f
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Lite/LanguageServer/Spec2Types.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env perl
package YATT::Lite::LanguageServer::Spec2Types;
use strict;
use warnings qw(FATAL all NONFATAL misc);
use File::AddInc;
use MOP4Import::Base::CLI_JSON -as_base;

use YATT::Lite::LanguageServer::SpecParser qw/Interface Decl/;

sub interface2typespec {
(my MY $self, my Interface $if) = @_;
if ($if->{extends}) {
...
} else {
[$if->{name} => [fields => map {
my Decl $slotDecl = $_;
if ($slotDecl->{kind}) {
Carp::croak "Not implemented for interface body: $slotDecl->{kind}";
} elsif ($slotDecl->{deprecated}) {
();
} else {
my $name = $slotDecl->{body}[0];
$name =~ s/\?\z//;
if ($slotDecl->{comment}) {
[$name => doc => $slotDecl->{comment}];
} else {
$name
}
}
} @{$if->{body}}]]
}
}

MY->run(\@ARGV) unless caller;

1;

0 comments on commit a8e571f

Please sign in to comment.