Files
sdk/pkg/kernel/lib/transformations/sanitize_for_vm.dart
T
Jens Johansen 6fe7b74e47 [kernel] Mark synthetic constructors as such
Fixes #31143

Change-Id: I2c844e48c955234de1b03de08c12729f72db4f3a
Reviewed-on: https://dart-review.googlesource.com/35921
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-01-19 12:29:56 +00:00

25 lines
846 B
Dart

// 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.
library kernel.transformations.fixvm;
import '../ast.dart';
/// Ensures that classes all have either a constructor or a procedure.
///
/// VM-specific constraints that don't fit in anywhere else can be put here.
class SanitizeForVM {
void transform(Program program) {
for (var library in program.libraries) {
for (var class_ in library.classes) {
if (class_.constructors.isEmpty && class_.procedures.isEmpty) {
class_.addMember(new Constructor(
new FunctionNode(new EmptyStatement()),
name: new Name(''),
isSynthetic: true));
}
}
}
}
}