Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw statement inside ternary expression parsing error #704

Closed
mayakwd opened this issue Nov 23, 2017 · 2 comments
Closed

Throw statement inside ternary expression parsing error #704

mayakwd opened this issue Nov 23, 2017 · 2 comments

Comments

@mayakwd
Copy link
Contributor

mayakwd commented Nov 23, 2017

Valid code:

package; 

class Test {
  public static function main() {
	trace(createInstance(null));
  }
    
  static function createInstance(type:Class<Dynamic>) {
     return type == null ? throw "Mamma mia" : Type.createInstance(type, []); 
  }
}
@RealyUniqueName
Copy link
Member

FYI: throw can appear anywhere. Even like this: if(throw "Surprise!") doStuff(throw "And again!");

@nadako
Copy link
Member

nadako commented Nov 23, 2017

"everything is an expression" :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants