Files
sdk/pkg/kernel/lib/transformations/sanitize_for_vm.dart
T
Peter von der Ahé 4f2bdff90b Rename Program to Component
Change-Id: I1a3cc03fba9783807fa637a9d42fdbad68ee7686
Reviewed-on: https://dart-review.googlesource.com/31040
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-03-15 12:22:23 +00:00

25 lines
852 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(Component component) {
for (var library in component.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));
}
}
}
}
}