21cc667dca
This adds support for having a final field and an external constructor without error, assuming that the external constructor initializes the final field. This supports the inline class with external members use case. Change-Id: I33b78275e967636ed0697d17f7921e9eee30401b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279095 Reviewed-by: Srujan Gaddam <srujzs@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Jens Johansen <jensj@google.com>
33 lines
774 B
Dart
33 lines
774 B
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.
|
|
|
|
/// Calls to [console.log] and to [log] from other modules don't work if the
|
|
/// js-interop annotations are not preserved. However, calls via [log2] and
|
|
/// [log3] do work because the annotation is available when compiling this
|
|
/// module.
|
|
@JS()
|
|
library log;
|
|
|
|
import 'package:js/js.dart';
|
|
|
|
@JS()
|
|
class Class {
|
|
external Class();
|
|
}
|
|
|
|
@JS()
|
|
class Console {
|
|
@JS()
|
|
external void log(arg);
|
|
}
|
|
|
|
@JS('console')
|
|
external Console get console;
|
|
|
|
@JS('console.log')
|
|
external void log(String s);
|
|
|
|
void log2(String s) => log(s);
|
|
void log3(String s) => console.log(s);
|