File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -417,6 +417,8 @@ def self.create_rbs_member(raw_decl, lenv)
417417 SigInstanceVariableNode . new ( raw_decl , lenv , false )
418418 when RBS ::AST ::Members ::ClassInstanceVariable
419419 SigInstanceVariableNode . new ( raw_decl , lenv , true )
420+ when RBS ::AST ::Members ::ClassVariable
421+ SigClassVariableNode . new ( raw_decl , lenv )
420422 else
421423 raise "unsupported: #{ raw_decl . class } "
422424 end
Original file line number Diff line number Diff line change @@ -473,6 +473,44 @@ def install0(genv)
473473 end
474474 end
475475
476+ class SigClassVariableNode < Node
477+ def initialize ( raw_decl , lenv )
478+ super ( raw_decl , lenv )
479+ @var = raw_decl . name
480+ @cpath = lenv . cref . cpath
481+ @type = AST . create_rbs_type ( raw_decl . type , lenv )
482+ end
483+
484+ attr_reader :cpath , :type
485+ def subnodes = { type : }
486+ def attrs = { cpath : }
487+
488+ def define0 ( genv )
489+ @type . define ( genv )
490+ cvar = genv . resolve_cvar ( cpath , @var )
491+ cvar . add_decl ( self )
492+ cvar
493+ end
494+
495+ def define_copy ( genv )
496+ cvar = genv . resolve_cvar ( cpath , @var )
497+ cvar . add_decl ( self )
498+ cvar . remove_decl ( @prev_node )
499+ super ( genv )
500+ end
501+
502+ def undefine0 ( genv )
503+ genv . resolve_cvar ( cpath , @var ) . remove_decl ( self )
504+ @type . undefine ( genv )
505+ end
506+
507+ def install0 ( genv )
508+ box = @changes . add_type_read_box ( genv , @type )
509+ @changes . add_edge ( genv , box . ret , @static_ret . vtx )
510+ box . ret
511+ end
512+ end
513+
476514 class SigGlobalVariableNode < Node
477515 def initialize ( raw_decl , lenv )
478516 super ( raw_decl , lenv )
Original file line number Diff line number Diff line change 1+ ## update: test.rbs
2+ class Foo
3+ @@foo : String
4+ end
5+
6+ ## update: test.rb
7+ class Foo
8+ def check
9+ @@foo
10+ end
11+ end
12+
13+ ## assert: test.rb
14+ class Foo
15+ def check : -> String
16+ end
You can’t perform that action at this time.
0 commit comments