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

Dartc not propagating function params in calls made in a named constructor initializer #565

Closed
pq opened this issue Nov 23, 2011 · 4 comments

Comments

@pq
Copy link
Member

pq commented Nov 23, 2011

class Foo {
  Foo.a(void func(var elm)){
    func("blah");
  }
  Foo.b(): this.a((str){
    print(str);
  });
}

main() {
  new Foo.b();
}

prints "null" instead of "blah"

I'm seeing this in the latest dartc in the editor as well as on dartboard (http://try.dartlang.org/s/23oh).

@DartBot
Copy link

DartBot commented Nov 24, 2011

This comment was originally written by [email protected]


Added Triaged label.

@DartBot
Copy link

DartBot commented Dec 9, 2011

This comment was originally written by [email protected]


codegen issue:

I added some debugging to the generated JS:

function unnamed746062$Foo$Dart$b$c0$function$22_1_2$HoistedConstructor$named($n, $o, str){
  if ($o.count || $n != 1)
    $nsme();
  print$getter()(1, $noargs, "in hoistedconstructor$named: str is "+str); // str prints out 'blah'
  return unnamed746062$Foo$Dart$b$c0$function$22_1_2$HoistedConstructor.call(this, str);
}

SO 'blah' is intact above, but, in the hoisted constructor, note how the two arguments have the same name:

function unnamed746062$Foo$Dart$b$c0$function$22_1_2$HoistedConstructor(str, str){
  print$getter()(1, $noargs, 'I am feeling very ' + $toString(str) + '');
}


Set owner to [email protected].

@DartBot
Copy link

DartBot commented Dec 9, 2011

This comment was originally written by [email protected]


Up for review @­ http://codereview.chromium.org/8894004


Added Started label.

@DartBot
Copy link

DartBot commented Dec 9, 2011

This comment was originally written by [email protected]


r2315


Added Fixed label.

copybara-service bot pushed a commit that referenced this issue Nov 9, 2023
Revisions updated by `dart tools/rev_sdk_deps.dart`.

collection (https://github.com/dart-lang/collection/compare/e8d7e92..f309148):
  f309148  2023-11-08  Kevin Moore  Latest lints, require Dart 3.1, use mixin (#322)

fixnum (https://github.com/dart-lang/fixnum/compare/3279f5d..6b0888c):
  6b0888c  2023-11-08  Kevin Moore  Update to latest lints and fix (#122)

markdown (https://github.com/dart-lang/markdown/compare/efb73b3..3774ad0):
  3774ad0  2023-11-07  Kevin Moore  Fix formatting for latest Dart dev SDK (#565)
  da11847  2023-11-07  Mosc  Fix beginning of line detection in `AutolinkExtensionSyntax` (#555)

tools (https://github.com/dart-lang/tools/compare/d898ad1..dd46ef2):
  dd46ef2  2023-11-09  Elias Yishak  Enum + event constructor added for `flutterCommandResult` (#199)

Change-Id: I8aa33f52c8afd50b60b225ad890f3e82945bcc50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335303
Reviewed-by: Konstantin Shcheglov <[email protected]>
Auto-Submit: Devon Carew <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants