OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 library kernel.transformations.fixvm; | 4 library kernel.transformations.fixvm; |
5 | 5 |
6 import '../ast.dart'; | 6 import '../ast.dart'; |
7 | 7 |
8 /// Ensures that classes all have either a constructor or a procedure. | 8 /// Ensures that classes all have either a constructor or a procedure. |
9 /// | 9 /// |
10 /// VM-specific constraints that don't fit in anywhere else can be put here. | 10 /// VM-specific constraints that don't fit in anywhere else can be put here. |
11 class SanitizeForVM { | 11 class SanitizeForVM { |
12 void transform(Program program) { | 12 void transform(Program program) { |
13 for (var library in program.libraries) { | 13 for (var library in program.libraries) { |
14 for (var class_ in library.classes) { | 14 for (var class_ in library.classes) { |
15 if (class_.constructors.isEmpty && class_.procedures.isEmpty) { | 15 if (class_.constructors.isEmpty && class_.procedures.isEmpty) { |
16 class_.addMember(new Constructor( | 16 class_.addMember(new Constructor( |
17 new FunctionNode(new InvalidStatement()), | 17 new FunctionNode(new EmptyStatement()), |
18 name: new Name(''))); | 18 name: new Name(''))); |
19 } | 19 } |
20 } | 20 } |
21 } | 21 } |
22 } | 22 } |
23 } | 23 } |
OLD | NEW |