Files
sdk/pkg/compiler/test/sourcemaps/stacktrace/extension_method.dart
T
Mayank Patke f79ed9301b [dart2js] Remove remaining language version overrides
Now that dart2js only takes migrated files as input, all tests should
use the current language version.

Change-Id: I6c84850f5786aeac04154b67bd7a3c19083c8bba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345344
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2024-01-23 01:26:09 +00:00

55 lines
1.1 KiB
Dart

// Copyright (c) 2019, 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.
class MyClass {
MyClass();
@pragma('dart2js:noInline')
set internalSetter(int v) {
/*7:MyClass.internalSetter*/ throw "error";
}
}
int q = 3;
extension Ext on MyClass {
@pragma('dart2js:noInline')
int method() {
this. /*6:Ext.method*/ internalSetter = 1;
return 0;
}
@pragma('dart2js:noInline')
int get propertyB => /*5:Ext.propertyB*/ method();
@pragma('dart2js:noInline')
set propertyA(int v) {
/*4:Ext.propertyA*/ propertyB;
}
@pragma('dart2js:noInline')
int operator +(int v) {
this. /*3:Ext.+*/ propertyA = 2;
return 1;
}
@pragma('dart2js:noInline')
int operator [](int v) => this /*2:Ext.[]*/ + 2;
}
extension on MyClass {
@pragma('dart2js:noInline')
int method2() => this /*1:MyClass.<anonymous extension>.method2*/ [0];
}
@pragma('dart2js:noInline')
confuse(x) => x;
main() {
q++;
confuse(null);
MyClass x = confuse(new MyClass());
x. /*0:main*/ method2();
}