HaxeCheckstyle / haxeparser

A Haxe parser for Haxe
61 stars 23 forks source link

cast(value) is not correctly parse #63

Closed lublak closed 2 years ago

lublak commented 2 years ago

cast(value) is currently parsed as ECast(ECheckType(value, null) ,null). But just should parse to ECast(value, null)

lublak commented 2 years ago

https://github.com/HaxeCheckstyle/haxeparser/blob/dace004f6aff39cf7cf3a9279da24f63b27de2af/src/haxeparser/HaxeParser.hx#L1707 can we just ask here if t is null?

Simn commented 2 years ago

Uhm, parseTypeHint should not accept in that case. The case _: null; should not be there, this is what parseTypeOpt is for. Try removing that case and see if everything explodes.

lublak commented 2 years ago

@Simn after removing: https://github.com/HaxeCheckstyle/haxeparser/blob/dace004f6aff39cf7cf3a9279da24f63b27de2af/src/haxeparser/HaxeParser.hx#L1030

it works fine