| 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 | 4 |
| 5 library sourcemap.diff_view; | 5 library sourcemap.diff_view; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 currentOptions.add(arg); | 64 currentOptions.add(arg); |
| 65 } else { | 65 } else { |
| 66 filename = arg; | 66 filename = arg; |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 List<String> commonArguments = optionSegments[0]; | 69 List<String> commonArguments = optionSegments[0]; |
| 70 List<List<String>> options = <List<String>>[]; | 70 List<List<String>> options = <List<String>>[]; |
| 71 if (optionSegments.length == 1) { | 71 if (optionSegments.length == 1) { |
| 72 // Use default options; comparing SSA and CPS output using the new | 72 // Use default options; comparing SSA and CPS output using the new |
| 73 // source information strategy. | 73 // source information strategy. |
| 74 options.add([USE_NEW_SOURCE_INFO]..addAll(commonArguments)); | 74 options.add([Flags.useNewSourceInfo]..addAll(commonArguments)); |
| 75 options.add([USE_NEW_SOURCE_INFO, Flags.useCpsIr]..addAll(commonArguments)); | 75 options.add( |
| 76 [Flags.useNewSourceInfo, Flags.useCpsIr]..addAll(commonArguments)); |
| 76 } else if (optionSegments.length == 2) { | 77 } else if (optionSegments.length == 2) { |
| 77 // Use alternative options for the second output column. | 78 // Use alternative options for the second output column. |
| 78 options.add(commonArguments); | 79 options.add(commonArguments); |
| 79 options.add(optionSegments[1]..addAll(commonArguments)); | 80 options.add(optionSegments[1]..addAll(commonArguments)); |
| 80 } else { | 81 } else { |
| 81 // Use specific options for both output columns. | 82 // Use specific options for both output columns. |
| 82 options.add(optionSegments[1]..addAll(commonArguments)); | 83 options.add(optionSegments[1]..addAll(commonArguments)); |
| 83 options.add(optionSegments[2]..addAll(commonArguments)); | 84 options.add(optionSegments[2]..addAll(commonArguments)); |
| 84 } | 85 } |
| 85 | 86 |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 }); | 453 }); |
| 453 mappedNodes.add(node); | 454 mappedNodes.add(node); |
| 454 return true; | 455 return true; |
| 455 } | 456 } |
| 456 | 457 |
| 457 | 458 |
| 458 for (TraceStep step in graph.steps) { | 459 for (TraceStep step in graph.steps) { |
| 459 String title = '${step.id}:${step.kind}:${step.offset}'; | 460 String title = '${step.id}:${step.kind}:${step.offset}'; |
| 460 if (!addSourceLocationsForNode(WITH_SOURCE_INFO, step.node, title)) { | 461 if (!addSourceLocationsForNode(WITH_SOURCE_INFO, step.node, title)) { |
| 461 int offset; | 462 int offset; |
| 462 if (options.contains(USE_NEW_SOURCE_INFO)) { | 463 if (options.contains(Flags.useNewSourceInfo)) { |
| 463 offset = step.offset.subexpressionOffset; | 464 offset = step.offset.subexpressionOffset; |
| 464 } else { | 465 } else { |
| 465 offset = info.jsCodePositions[step.node].startPosition; | 466 offset = info.jsCodePositions[step.node].startPosition; |
| 466 } | 467 } |
| 467 if (offset != null) { | 468 if (offset != null) { |
| 468 addAnnotation(WITHOUT_SOURCE_INFO, offset, title); | 469 addAnnotation(WITHOUT_SOURCE_INFO, offset, title); |
| 469 } | 470 } |
| 470 } | 471 } |
| 471 } | 472 } |
| 472 for (js.Node node in info.nodeMap.nodes) { | 473 for (js.Node node in info.nodeMap.nodes) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 kind = CodeKind.MEMBER; | 560 kind = CodeKind.MEMBER; |
| 560 uri = astElement.compilationUnit.script.resourceUri; | 561 uri = astElement.compilationUnit.script.resourceUri; |
| 561 name = computeElementNameForSourceMaps(astElement); | 562 name = computeElementNameForSourceMaps(astElement); |
| 562 if (astElement.hasNode) { | 563 if (astElement.hasNode) { |
| 563 begin = astElement.node.getBeginToken().charOffset; | 564 begin = astElement.node.getBeginToken().charOffset; |
| 564 end = astElement.node.getEndToken().charEnd; | 565 end = astElement.node.getEndToken().charEnd; |
| 565 } | 566 } |
| 566 } | 567 } |
| 567 return new CodeSource(kind, uri, name, begin, end); | 568 return new CodeSource(kind, uri, name, begin, end); |
| 568 } | 569 } |
| OLD | NEW |