Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: pkg/kernel/bin/transform.dart

Issue 2688513004: [kernel] Rewrite method calls transformation (Closed)
Patch Set: Changes based on feedback Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/kernel/lib/transformations/empty.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:args/args.dart'; 9 import 'package:args/args.dart';
10 import 'package:kernel/kernel.dart';
11 import 'package:kernel/transformations/closure_conversion.dart' as closures;
12 import 'package:kernel/transformations/continuation.dart' as cont;
13 import 'package:kernel/transformations/empty.dart' as empty;
14 import 'package:kernel/transformations/infer_values.dart' as infer_values;
15 import 'package:kernel/transformations/method_call.dart' as method_call;
16 import 'package:kernel/transformations/mixin_full_resolution.dart' as mix;
17 import 'package:kernel/transformations/treeshaker.dart' as treeshaker;
10 import 'package:kernel/verifier.dart'; 18 import 'package:kernel/verifier.dart';
11 import 'package:kernel/kernel.dart';
12 import 'package:kernel/transformations/continuation.dart' as cont;
13 import 'package:kernel/transformations/infer_values.dart' as infer_values;
14 import 'package:kernel/transformations/mixin_full_resolution.dart' as mix;
15 import 'package:kernel/transformations/closure_conversion.dart' as closures;
16 import 'package:kernel/transformations/treeshaker.dart' as treeshaker;
17 19
20 import 'batch_util.dart';
18 import 'util.dart'; 21 import 'util.dart';
19 import 'batch_util.dart';
20 22
21 ArgParser parser = new ArgParser() 23 ArgParser parser = new ArgParser()
22 ..addOption('format', 24 ..addOption('format',
23 abbr: 'f', 25 abbr: 'f',
24 allowed: ['text', 'bin'], 26 allowed: ['text', 'bin'],
25 defaultsTo: 'bin', 27 defaultsTo: 'bin',
26 help: 'Output format.') 28 help: 'Output format.')
27 ..addOption('out', abbr: 'o', help: 'Output file.', defaultsTo: null) 29 ..addOption('out', abbr: 'o', help: 'Output file.', defaultsTo: null)
28 ..addFlag('verbose', 30 ..addFlag('verbose',
29 abbr: 'v', 31 abbr: 'v',
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 case 'resolve-mixins': 85 case 'resolve-mixins':
84 program = mix.transformProgram(program); 86 program = mix.transformProgram(program);
85 break; 87 break;
86 case 'closures': 88 case 'closures':
87 program = closures.transformProgram(program); 89 program = closures.transformProgram(program);
88 break; 90 break;
89 case 'treeshake': 91 case 'treeshake':
90 program = 92 program =
91 treeshaker.transformProgram(program, programRoots: programRoots); 93 treeshaker.transformProgram(program, programRoots: programRoots);
92 break; 94 break;
95 case 'methodcall':
96 program = method_call.transformProgram(program);
97 break;
98 case 'empty':
99 program = empty.transformProgram(program);
100 break;
93 default: 101 default:
94 throw 'Unknown transformation'; 102 throw 'Unknown transformation';
95 } 103 }
96 104
97 verifyProgram(program); 105 verifyProgram(program);
98 106
99 if (format == 'text') { 107 if (format == 'text') {
100 writeProgramToText(program, path: output); 108 writeProgramToText(program, path: output);
101 } else { 109 } else {
102 assert(format == 'bin'); 110 assert(format == 'bin');
103 await writeProgramToBinary(program, output); 111 await writeProgramToBinary(program, output);
104 } 112 }
105 113
106 if (verbose) { 114 if (verbose) {
107 writeLibraryToText(program.mainMethod.parent as Library); 115 writeLibraryToText(program.mainMethod.parent as Library);
108 } 116 }
109 117
110 return CompilerOutcome.Ok; 118 return CompilerOutcome.Ok;
111 } 119 }
OLDNEW
« no previous file with comments | « no previous file | pkg/kernel/lib/transformations/empty.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698