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

Side by Side Diff: pkg/kernel/lib/text/ast_to_text.dart

Issue 3008763002: Store actual Reference(s) for additional exports. (Closed)
Patch Set: Fixes for review comments. Created 3 years, 3 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 | « pkg/kernel/lib/import_table.dart ('k') | runtime/vm/kernel_binary_flowgraph.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.ast_to_text; 4 library kernel.ast_to_text;
5 5
6 import '../ast.dart'; 6 import '../ast.dart';
7 import '../import_table.dart'; 7 import '../import_table.dart';
8 8
9 class Namer<T> { 9 class Namer<T> {
10 int index = 0; 10 int index = 0;
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 var importPath = imports.getImportPath(library); 276 var importPath = imports.getImportPath(library);
277 if (importPath == "") { 277 if (importPath == "") {
278 var prefix = 278 var prefix =
279 syntheticNames.nameLibraryPrefix(library, proposedName: 'self'); 279 syntheticNames.nameLibraryPrefix(library, proposedName: 'self');
280 endLine('import self as $prefix;'); 280 endLine('import self as $prefix;');
281 } else { 281 } else {
282 var prefix = syntheticNames.nameLibraryPrefix(library); 282 var prefix = syntheticNames.nameLibraryPrefix(library);
283 endLine('import "$importPath" as $prefix;'); 283 endLine('import "$importPath" as $prefix;');
284 } 284 }
285 } 285 }
286
286 // TODO(scheglov): Do we want to print dependencies? dartbug.com/30224 287 // TODO(scheglov): Do we want to print dependencies? dartbug.com/30224
288 if (library.additionalExports.isNotEmpty) {
289 write('additionalExports = (');
290 for (var reference in library.additionalExports) {
291 var node = reference.node;
292 if (node is Class) {
293 Library nodeLibrary = node.enclosingLibrary;
294 String prefix = syntheticNames.nameLibraryPrefix(nodeLibrary);
295 write(prefix + '::' + node.name);
296 } else if (node is Field) {
297 Library nodeLibrary = node.enclosingLibrary;
298 String prefix = syntheticNames.nameLibraryPrefix(nodeLibrary);
299 write(prefix + '::' + node.name.name);
300 } else if (node is Procedure) {
301 Library nodeLibrary = node.enclosingLibrary;
302 String prefix = syntheticNames.nameLibraryPrefix(nodeLibrary);
303 write(prefix + '::' + node.name.name);
304 } else if (node is Typedef) {
305 Library nodeLibrary = node.enclosingLibrary;
306 String prefix = syntheticNames.nameLibraryPrefix(nodeLibrary);
307 write(prefix + '::' + node.name);
308 } else {
309 throw new UnimplementedError('${node.runtimeType}');
310 }
311 }
312 endLine(')');
313 }
314
287 endLine(); 315 endLine();
288 var inner = new Printer._inner(this, imports); 316 var inner = new Printer._inner(this, imports);
289 library.typedefs.forEach(inner.writeNode); 317 library.typedefs.forEach(inner.writeNode);
290 library.classes.forEach(inner.writeNode); 318 library.classes.forEach(inner.writeNode);
291 library.fields.forEach(inner.writeNode); 319 library.fields.forEach(inner.writeNode);
292 library.procedures.forEach(inner.writeNode); 320 library.procedures.forEach(inner.writeNode);
293 } 321 }
294 322
295 void writeProgramFile(Program program) { 323 void writeProgramFile(Program program) {
296 ImportTable imports = new ProgramImportTable(program); 324 ImportTable imports = new ProgramImportTable(program);
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 } 1700 }
1673 throw 'illegal ProcedureKind: $kind'; 1701 throw 'illegal ProcedureKind: $kind';
1674 } 1702 }
1675 1703
1676 class ExpressionPrinter { 1704 class ExpressionPrinter {
1677 final Printer writeer; 1705 final Printer writeer;
1678 final int minimumPrecedence; 1706 final int minimumPrecedence;
1679 1707
1680 ExpressionPrinter(this.writeer, this.minimumPrecedence); 1708 ExpressionPrinter(this.writeer, this.minimumPrecedence);
1681 } 1709 }
OLDNEW
« no previous file with comments | « pkg/kernel/lib/import_table.dart ('k') | runtime/vm/kernel_binary_flowgraph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698