-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow 'super' in async and finally blocks
Fixes #499 Fixes #528 R=jmesserly@google.com Review URL: https://codereview.chromium.org/1948563002 .
- Loading branch information
1 parent
7d32105
commit d9e0533
Showing
10 changed files
with
288 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
pkg/dev_compiler/test/codegen/language/super_in_async1_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import "package:expect/expect.dart"; | ||
|
||
import 'dart:async'; | ||
|
||
class A { | ||
Future<int> foo() async => 42; | ||
} | ||
|
||
class B extends A { | ||
Future<int> foo() async { | ||
var x = await super.foo(); | ||
return x + 1; | ||
} | ||
} | ||
|
||
main() async { | ||
Expect.equals(43, await new B().foo()); | ||
} |
23 changes: 23 additions & 0 deletions
23
pkg/dev_compiler/test/codegen/language/super_in_async2_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import "package:expect/expect.dart"; | ||
|
||
import 'dart:async'; | ||
|
||
class A { | ||
Future<int> foo() async => 42; | ||
} | ||
|
||
class B extends A { | ||
Future<int> foo() async { | ||
var x = await super.foo(); | ||
var y = await super.foo(); | ||
return x + y; | ||
} | ||
} | ||
|
||
main() async { | ||
Expect.equals(84, await new B().foo()); | ||
} |
22 changes: 22 additions & 0 deletions
22
pkg/dev_compiler/test/codegen/language/super_in_async3_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import "package:expect/expect.dart"; | ||
|
||
import 'dart:async'; | ||
|
||
class A { | ||
Future/*<T>*/ foo/*<T>*/(/*=T*/ x) async => x; | ||
} | ||
|
||
class B extends A { | ||
Future<int> bar() async { | ||
var x = await super.foo(41); | ||
return x + 1; | ||
} | ||
} | ||
|
||
main() async { | ||
Expect.equals(42, await new B().bar()); | ||
} |
22 changes: 22 additions & 0 deletions
22
pkg/dev_compiler/test/codegen/language/super_in_async4_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import "package:expect/expect.dart"; | ||
|
||
import 'dart:async'; | ||
|
||
class A { | ||
Future/*<T>*/ foo/*<T>*/({/*=T*/ x}) async => x; | ||
} | ||
|
||
class B extends A { | ||
Future<int> bar() async { | ||
var x = await super.foo(x: 41); | ||
return x + 1; | ||
} | ||
} | ||
|
||
main() async { | ||
Expect.equals(42, await new B().bar()); | ||
} |
22 changes: 22 additions & 0 deletions
22
pkg/dev_compiler/test/codegen/language/super_in_async5_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import "package:expect/expect.dart"; | ||
|
||
import 'dart:async'; | ||
|
||
class A { | ||
Future<int> get foo async => 42; | ||
} | ||
|
||
class B extends A { | ||
Future<int> bar() async { | ||
var x = await super.foo; | ||
return x + 1; | ||
} | ||
} | ||
|
||
main() async { | ||
Expect.equals(43, await new B().bar()); | ||
} |
Oops, something went wrong.