mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Styling changes
This commit is contained in:
parent
6b2ddcb1d9
commit
d20cc212b9
3 changed files with 5 additions and 6 deletions
|
@ -21,7 +21,8 @@ module Ameba::AST
|
||||||
|
|
||||||
it "raises if type declaration is incorrect" do
|
it "raises if type declaration is incorrect" do
|
||||||
type_dec = Crystal::TypeDeclaration.new(declared_type, declared_type)
|
type_dec = Crystal::TypeDeclaration.new(declared_type, declared_type)
|
||||||
expect_raises(Exception, "unsupported var node type: Crystal::Path") do
|
|
||||||
|
expect_raises(Exception, "Unsupported var node type: Crystal::Path") do
|
||||||
TypeDecVariable.new(type_dec).name
|
TypeDecVariable.new(type_dec).name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -141,7 +141,7 @@ module Ameba::AST
|
||||||
|
|
||||||
# Returns `true` if type declaration variable is assigned in this scope.
|
# Returns `true` if type declaration variable is assigned in this scope.
|
||||||
def assigns_type_dec?(name)
|
def assigns_type_dec?(name)
|
||||||
type_dec_variables.any?(&.name.== name) || outer_scope.try(&.assigns_type_dec?(name))
|
type_dec_variables.any?(&.name.== name) || !!outer_scope.try(&.assigns_type_dec?(name))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns `true` if and only if current scope represents some
|
# Returns `true` if and only if current scope represents some
|
||||||
|
|
|
@ -10,13 +10,11 @@ module Ameba::AST
|
||||||
end
|
end
|
||||||
|
|
||||||
def name
|
def name
|
||||||
var = @node.var
|
case var = @node.var
|
||||||
|
|
||||||
case var
|
|
||||||
when Crystal::Var, Crystal::InstanceVar, Crystal::ClassVar, Crystal::Global
|
when Crystal::Var, Crystal::InstanceVar, Crystal::ClassVar, Crystal::Global
|
||||||
var.name
|
var.name
|
||||||
else
|
else
|
||||||
raise "unsupported var node type: #{var.class}"
|
raise "Unsupported var node type: #{var.class}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue