Skip to content

Commit

Permalink
Fix a typo of the context name of parsing asm options
Browse files Browse the repository at this point in the history
  • Loading branch information
makenowjust authored and Martin Verzilli committed Jul 9, 2017
1 parent d803e78 commit b3c8f87
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions spec/compiler/parser/parser_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1230,6 +1230,9 @@ describe "Parser" do
it_parses %(asm("nop" :: "b"(1), "c"(2) : "eax", "ebx"\n: "volatile", "alignstack"\n,\n"intel"\n)), Asm.new("nop", inputs: [AsmOperand.new("b", 1.int32), AsmOperand.new("c", 2.int32)], clobbers: %w(eax ebx), volatile: true, alignstack: true, intel: true)
it_parses %(asm("nop" :::: "volatile")), Asm.new("nop", volatile: true)

assert_syntax_error %q(asm("nop" ::: "#{foo}")), "interpolation not allowed in asm clobber"
assert_syntax_error %q(asm("nop" :::: "#{volatile}")), "interpolation not allowed in asm option"

it_parses "foo begin\nbar do\nend\nend", Call.new(nil, "foo", Expressions.new([Call.new(nil, "bar", block: Block.new)] of ASTNode))
it_parses "foo 1.bar do\nend", Call.new(nil, "foo", args: [Call.new(1.int32, "bar")] of ASTNode, block: Block.new)
it_parses "return 1.bar do\nend", Return.new(Call.new(1.int32, "bar", block: Block.new))
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/syntax/parser.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4709,7 +4709,7 @@ module Crystal
intel = false
while true
location = @token.location
option = parse_string_without_interpolation("asm clobber")
option = parse_string_without_interpolation("asm option")
skip_space_or_newline
case option
when "volatile"
Expand Down

0 comments on commit b3c8f87

Please sign in to comment.