Do not set $!
to SyntaxError
when error tolerant
This commit is contained in:
parent
d9e2ef6000
commit
546566d34b
Notes:
git
2025-06-06 00:31:58 +00:00
2
parse.y
2
parse.y
@ -6488,8 +6488,8 @@ yycompile0(VALUE arg)
|
|||||||
if (!mesg) {
|
if (!mesg) {
|
||||||
mesg = rb_class_new_instance(0, 0, rb_eSyntaxError);
|
mesg = rb_class_new_instance(0, 0, rb_eSyntaxError);
|
||||||
}
|
}
|
||||||
rb_set_errinfo(mesg);
|
|
||||||
if (!p->error_tolerant) {
|
if (!p->error_tolerant) {
|
||||||
|
rb_set_errinfo(mesg);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -576,6 +576,7 @@ dummy
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
STR
|
STR
|
||||||
|
assert_nil($!)
|
||||||
|
|
||||||
assert_equal(:SCOPE, node.type)
|
assert_equal(:SCOPE, node.type)
|
||||||
end
|
end
|
||||||
@ -965,6 +966,7 @@ dummy
|
|||||||
|
|
||||||
def assert_error_tolerant(src, expected)
|
def assert_error_tolerant(src, expected)
|
||||||
node = RubyVM::AbstractSyntaxTree.parse(src, error_tolerant: true)
|
node = RubyVM::AbstractSyntaxTree.parse(src, error_tolerant: true)
|
||||||
|
assert_nil($!)
|
||||||
str = ""
|
str = ""
|
||||||
PP.pp(node, str, 80)
|
PP.pp(node, str, 80)
|
||||||
assert_equal(expected, str)
|
assert_equal(expected, str)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user