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

Side by Side Diff: pkg/compiler/lib/src/dump_info.dart

Issue 1293533006: Revert use of ?? to unbreak the build (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 4
5 library dump_info; 5 library dump_info;
6 6
7 import 'dart:convert' 7 import 'dart:convert'
8 show HtmlEscape, JsonEncoder, StringConversionSink, ChunkedConversionSink; 8 show HtmlEscape, JsonEncoder, StringConversionSink, ChunkedConversionSink;
9 9
10 import 'package:dart2js_info/info.dart'; 10 import 'package:dart2js_info/info.dart';
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 // was generated for an element. If no source 464 // was generated for an element. If no source
465 // code was produced, return 0. 465 // code was produced, return 0.
466 int sizeOf(Element element) { 466 int sizeOf(Element element) {
467 if (_elementToNodes.containsKey(element)) { 467 if (_elementToNodes.containsKey(element)) {
468 return _elementToNodes[element].map(sizeOfNode).fold(0, (a, b) => a + b); 468 return _elementToNodes[element].map(sizeOfNode).fold(0, (a, b) => a + b);
469 } else { 469 } else {
470 return 0; 470 return 0;
471 } 471 }
472 } 472 }
473 473
474 int sizeOfNode(jsAst.Node node) => _nodeToSize[node] ?? 0; 474 int sizeOfNode(jsAst.Node node) {
475 // TODO(sigmund): switch back to null aware operators (issue #24136)
476 var size = _nodeToSize[node];
477 return size == null ? 0 : size;
478 }
475 479
476 String codeOf(Element element) { 480 String codeOf(Element element) {
477 List<jsAst.Node> code = _elementToNodes[element]; 481 List<jsAst.Node> code = _elementToNodes[element];
478 if (code == null) return null; 482 if (code == null) return null;
479 // Concatenate rendered ASTs. 483 // Concatenate rendered ASTs.
480 StringBuffer sb = new StringBuffer(); 484 StringBuffer sb = new StringBuffer();
481 for (jsAst.Node ast in code) { 485 for (jsAst.Node ast in code) {
482 sb.writeln(jsAst.prettyPrint(ast, compiler).getText()); 486 sb.writeln(jsAst.prettyPrint(ast, compiler).getText());
483 } 487 }
484 return sb.toString(); 488 return sb.toString();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 562
559 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( 563 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion(
560 new StringConversionSink.fromStringSink(buffer)); 564 new StringConversionSink.fromStringSink(buffer));
561 sink.add(result.toJson()); 565 sink.add(result.toJson());
562 compiler.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { 566 compiler.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, {
563 'text': "View the dumped .info.json file at " 567 'text': "View the dumped .info.json file at "
564 "https://dart-lang.github.io/dump-info-visualizer" 568 "https://dart-lang.github.io/dump-info-visualizer"
565 }); 569 });
566 } 570 }
567 } 571 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698