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

Labeled local function declaration crashes dart2js #19633

Closed
lrhn opened this issue Jun 24, 2014 · 5 comments
Closed

Labeled local function declaration crashes dart2js #19633

lrhn opened this issue Jun 24, 2014 · 5 comments

Comments

@lrhn
Copy link
Member

lrhn commented Jun 24, 2014

Example code:
  main() {
    foo: int bar() => 42;
  }
crashes dart2js.

The spec allows labels in front of local variable and function declarations.

@floitschG
Copy link
Contributor

The compiler crashed: type 'LocalFunctionElementX' is not a subtype of type 'TargetElement' of 'function result'.
#­0 ResolutionRegistry.getTargetOf (file:///mnt/ssd/floitsch/code/dart/dart/sdk/lib/_internal/compiler/implementation/resolution/registry.dart:158:19)
#­1 ResolverVisitor.visitLabeledStatement (file:///mnt/ssd/floitsch/code/dart/dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart:3429:29)
#­2 LabeledStatement.accept (file:///mnt/ssd/floitsch/code/dart/dart/sdk/lib/_internal/compiler/implementation/tree/nodes.dart:1719:59)
#­3 CommonResolverVisitor.visit (file:///mnt/ssd/floitsch/code/dart/dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart:1531:60)
#­4 ResolverVisitor.visitNodeList (file:///mnt/ssd/floitsch/code/dart/dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart:2892:12)
#­5 NodeList.accept (file:///mnt/ssd/floitsch/code/dart/dart/sdk/lib/_internal/compiler/implementation/tree/nodes.dart:536:51)
#­6 CommonResolverVisitor.visit (file:///mnt/ssd/floitsch/code/dart/dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart:1531:60)
#­7 ResolverVisitor.visitIn (file:///mnt/ssd/floitsch/code/dart/dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart:2249:28)
...


Removed Priority-Unassigned label.
Added Priority-Low label.

@lrhn
Copy link
Member Author

lrhn commented Mar 6, 2015

Maybe we should instead change the spec so localVariableDeclaration and localFunctionDeclaration are not unlabledStatement, but are instead productions directly on the statement non-terminal. They are really declarations, not statements.


cc @gbracha.

@gbracha
Copy link
Contributor

gbracha commented Mar 9, 2015

I suppose we could do that, but:

a. Local var decls include executable code, and so are just as much statements as anything else. b. Changing the spec impacts the VM as well. The approach of changing the spec when an implementation has a bug is not really attractive.

@floitschG
Copy link
Contributor

The language should definitely not be changed just to avoid us fixing a bug.

Lasse's suggestion might make sense on its own, though. (But you, Gilad, seem to disagree).


Removed Priority-Low label.
Added Priority-Medium label.

@sigmundch
Copy link
Member

this appears to be working now.

@kevmoo kevmoo removed the triaged label Mar 1, 2016
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

5 participants