From 595f24dcfd371b10c90d5a76ea0f12c4f61108d6 Mon Sep 17 00:00:00 2001 From: Ary Borenszweig <aborenszweig@manas.com.ar> Date: Fri, 31 Oct 2014 19:37:35 -0300 Subject: [PATCH] Fixed: `abstract struct` didn't parse --- spec/compiler/parser/parser_spec.cr | 1 + src/compiler/crystal/syntax/parser.cr | 2 ++ 2 files changed, 3 insertions(+) diff --git a/spec/compiler/parser/parser_spec.cr b/spec/compiler/parser/parser_spec.cr index c23b77042d..ef45737686 100755 --- a/spec/compiler/parser/parser_spec.cr +++ b/spec/compiler/parser/parser_spec.cr @@ -404,6 +404,7 @@ describe "Parser" do it_parses "class Foo < Bar; end", ClassDef.new("Foo".path, superclass: "Bar".path) it_parses "class Foo(T); end", ClassDef.new("Foo".path, type_vars: ["T"]) it_parses "abstract class Foo; end", ClassDef.new("Foo".path, abstract: true) + it_parses "abstract struct Foo; end", ClassDef.new("Foo".path, abstract: true, struct: true) it_parses "struct Foo; end", ClassDef.new("Foo".path, struct: true) diff --git a/src/compiler/crystal/syntax/parser.cr b/src/compiler/crystal/syntax/parser.cr index 008d71449f..cbf2b90562 100644 --- a/src/compiler/crystal/syntax/parser.cr +++ b/src/compiler/crystal/syntax/parser.cr @@ -811,6 +811,8 @@ module Crystal parse_def is_abstract: true when :class parse_class_def is_abstract: true + when :struct + parse_class_def is_abstract: true, is_struct: true else unexpected_token end -- GitLab