mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 10:18:13 +00:00
[test] Replace non-implemented @DontInline()
annotations
Remove the `@DontInline()` annotation. None of the backends implemented it. (Searching for "DontInline" yields nothing in our code base.) Instead replaced the use sites with `@pragma('vm:never-inline')` and `@pragma('dart2js:noInline')`, which are implemented in the backends. Original suggestion: https://dart-review.googlesource.com/c/sdk/+/208080/4..6/tests/language_2/const/map_hashcode_override_test.dart#b11 Change-Id: Ifdcfc8ef3413d0b5964edc1bc1fa47c5ce306935 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208082 Reviewed-by: Erik Ernst <eernst@google.com> Commit-Queue: Daco Harkes <dacoharkes@google.com>
This commit is contained in:
parent
a5d4e010af
commit
db90fd784b
|
@ -9,13 +9,13 @@
|
|||
// methods to handle `noSuchMethod`.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
class Foo {
|
||||
noSuchMethod(im) => 42;
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
returnFoo() {
|
||||
(() => 42)();
|
||||
return new Foo();
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
// methods to handle `noSuchMethod`.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
abstract class Foo {
|
||||
noSuchMethod(im) => 42;
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
returnFoo() {
|
||||
(() => 42)();
|
||||
return new Foo();
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
// Copyright (c) 2013, 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.
|
||||
|
||||
library compiler_annotations;
|
||||
|
||||
// This library contains annotations useful for testing.
|
||||
|
||||
// TODO(ngeoffray): Implement in dart2js.
|
||||
class DontInline {
|
||||
const DontInline();
|
||||
}
|
|
@ -3,7 +3,6 @@
|
|||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
var a = [null];
|
||||
|
||||
|
@ -11,7 +10,8 @@ class A {
|
|||
var foo;
|
||||
var bar;
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
A() {
|
||||
// Currently defeat inlining by using a closure.
|
||||
bar = () => 42;
|
||||
|
@ -24,7 +24,8 @@ class B {
|
|||
var foo;
|
||||
var bar;
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
B() {
|
||||
// Currently defeat inlining by using a closure.
|
||||
bar = () => 42;
|
||||
|
@ -44,7 +45,8 @@ main() {
|
|||
new B();
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
bar() {
|
||||
// Currently defeat inlining by using a closure.
|
||||
Expect.throwsNoSuchMethodError(() => new A().foo + 42);
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
// inlined.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
class A {
|
||||
var foo;
|
||||
var bar;
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
A() {
|
||||
// Currently defeat inlining by using a closure.
|
||||
bar = () => 42;
|
||||
|
@ -33,7 +33,8 @@ main() {
|
|||
class B {
|
||||
var bar;
|
||||
var closure;
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
B() {
|
||||
// Currently defeat inlining by using a closure.
|
||||
closure = () => 42;
|
||||
|
@ -41,7 +42,8 @@ class B {
|
|||
}
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
bar() {
|
||||
// Make sure B's constructor is analyzed first by surrounding the
|
||||
// body by two allocations.
|
||||
|
@ -52,7 +54,8 @@ bar() {
|
|||
new B();
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
codegenLast() {
|
||||
// This assignment currently defeats simple type inference, but not
|
||||
// the optimistic inferrer.
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
// inlined.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
class A {
|
||||
var field;
|
||||
|
@ -24,14 +23,16 @@ main() {
|
|||
bar();
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
doIt() {
|
||||
() => 42;
|
||||
var c = new A(null);
|
||||
Expect.throwsNoSuchMethodError(() => c.field + 42);
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
bar() {
|
||||
() => 42;
|
||||
return inlineLevel1();
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
// correctly infer optional named parameters.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
foo({path}) {
|
||||
() => 42;
|
||||
return path;
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
// 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 '../compiler_annotations.dart';
|
||||
|
||||
class A {
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
A([a]) {
|
||||
() => 42;
|
||||
if (a != null) throw 'Test failed';
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
class A {
|
||||
int field = -1;
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
A(param) {
|
||||
// Currently defeat inlining by using a closure.
|
||||
var bar = () => 42;
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
// [foo].
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
main() {
|
||||
var result = foo(1, 2);
|
||||
|
@ -18,7 +17,8 @@ main() {
|
|||
Expect.listEquals([], result[1]);
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
foo(a, b) {
|
||||
() => 42;
|
||||
if (a is List) {
|
||||
|
|
|
@ -6,15 +6,16 @@
|
|||
// correctly infer optional named parameters.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
foo({path}) {
|
||||
() => 42;
|
||||
return path.toString();
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
bar({path}) {
|
||||
() => 42;
|
||||
return path;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
// work for Object methods.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
main() {
|
||||
var a = true ? null : 42;
|
||||
|
@ -15,7 +14,8 @@ main() {
|
|||
foo(a);
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
foo(a) {
|
||||
var f = () => 42;
|
||||
Expect.throwsNoSuchMethodError(() => a + 42);
|
||||
|
|
|
@ -11,14 +11,13 @@
|
|||
// methods to handle `noSuchMethod`.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
|
||||
class Foo {
|
||||
class Foo {
|
||||
noSuchMethod(im) => 42;
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
returnFoo() {
|
||||
(() => 42)();
|
||||
return new Foo();
|
||||
|
|
|
@ -8,14 +8,13 @@
|
|||
// methods to handle `noSuchMethod`.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
abstract
|
||||
class Foo {
|
||||
abstract class Foo {
|
||||
noSuchMethod(im) => 42;
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
returnFoo() {
|
||||
(() => 42)();
|
||||
return new Foo();
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
// Copyright (c) 2013, 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.
|
||||
|
||||
// @dart = 2.9
|
||||
|
||||
library compiler_annotations;
|
||||
|
||||
// This library contains annotations useful for testing.
|
||||
|
||||
// TODO(ngeoffray): Implement in dart2js.
|
||||
class DontInline {
|
||||
const DontInline();
|
||||
}
|
|
@ -5,7 +5,6 @@
|
|||
// @dart = 2.9
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
var a = [null];
|
||||
|
||||
|
@ -13,7 +12,8 @@ class A {
|
|||
var foo;
|
||||
var bar;
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
A() {
|
||||
// Currently defeat inlining by using a closure.
|
||||
bar = () => 42;
|
||||
|
@ -26,7 +26,8 @@ class B {
|
|||
var foo;
|
||||
var bar;
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
B() {
|
||||
// Currently defeat inlining by using a closure.
|
||||
bar = () => 42;
|
||||
|
@ -46,7 +47,8 @@ main() {
|
|||
new B();
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
bar() {
|
||||
// Currently defeat inlining by using a closure.
|
||||
Expect.throwsNoSuchMethodError(() => new A().foo + 42);
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
// inlined.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
class A {
|
||||
var foo;
|
||||
var bar;
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
A() {
|
||||
// Currently defeat inlining by using a closure.
|
||||
bar = () => 42;
|
||||
|
@ -35,7 +35,8 @@ main() {
|
|||
class B {
|
||||
var bar;
|
||||
var closure;
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
B() {
|
||||
// Currently defeat inlining by using a closure.
|
||||
closure = () => 42;
|
||||
|
@ -43,7 +44,8 @@ class B {
|
|||
}
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
bar() {
|
||||
// Make sure B's constructor is analyzed first by surrounding the
|
||||
// body by two allocations.
|
||||
|
@ -54,7 +56,8 @@ bar() {
|
|||
new B();
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
codegenLast() {
|
||||
// This assignment currently defeats simple type inference, but not
|
||||
// the optimistic inferrer.
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
// inlined.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
class A {
|
||||
var field;
|
||||
|
@ -26,14 +25,16 @@ main() {
|
|||
bar();
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
doIt() {
|
||||
() => 42;
|
||||
var c = new A(null);
|
||||
Expect.throwsNoSuchMethodError(() => c.field + 42);
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
bar() {
|
||||
() => 42;
|
||||
return inlineLevel1();
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
// correctly infer optional named parameters.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
foo({path}) {
|
||||
() => 42;
|
||||
return path;
|
||||
|
|
|
@ -4,10 +4,9 @@
|
|||
|
||||
// @dart = 2.9
|
||||
|
||||
import '../compiler_annotations.dart';
|
||||
|
||||
class A {
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
A([a]) {
|
||||
() => 42;
|
||||
if (a != null) throw 'Test failed';
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
// @dart = 2.9
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
class A {
|
||||
int field;
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
A(param) {
|
||||
// Currently defeat inlining by using a closure.
|
||||
var bar = () => 42;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
// [foo].
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
main() {
|
||||
var result = foo(1, 2);
|
||||
|
@ -20,7 +19,8 @@ main() {
|
|||
Expect.listEquals([], result[1]);
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
foo(a, b) {
|
||||
() => 42;
|
||||
if (a is List) {
|
||||
|
|
|
@ -8,15 +8,16 @@
|
|||
// correctly infer optional named parameters.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
foo({path}) {
|
||||
() => 42;
|
||||
return path.toString();
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
bar({path}) {
|
||||
() => 42;
|
||||
return path;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
// work for Object methods.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "../compiler_annotations.dart";
|
||||
|
||||
main() {
|
||||
var a = true ? null : 42;
|
||||
|
@ -17,7 +16,8 @@ main() {
|
|||
foo(a);
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
foo(a) {
|
||||
var f = () => 42;
|
||||
Expect.throwsNoSuchMethodError(() => a + 42);
|
||||
|
|
|
@ -6,16 +6,17 @@
|
|||
// literal might become an int at runtime.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import '../language/compiler_annotations.dart';
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
callWithStringAndDouble(value) {
|
||||
() => 42;
|
||||
if (value is! int) throw new ArgumentError(value);
|
||||
return 42;
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
callWithDouble(value) {
|
||||
() => 42;
|
||||
if (value is! int) throw new ArgumentError(value);
|
||||
|
|
|
@ -8,16 +8,17 @@
|
|||
// literal might become an int at runtime.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import '../language_2/compiler_annotations.dart';
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
callWithStringAndDouble(value) {
|
||||
() => 42;
|
||||
if (value is! int) throw new ArgumentError(value);
|
||||
return 42;
|
||||
}
|
||||
|
||||
@DontInline()
|
||||
@pragma('vm:never-inline')
|
||||
@pragma('dart2js:noInline')
|
||||
callWithDouble(value) {
|
||||
() => 42;
|
||||
if (value is! int) throw new ArgumentError(value);
|
||||
|
|
Loading…
Reference in a new issue