| OLD | NEW | 
|---|
| 1 // Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:io'; | 5 import 'dart:io'; | 
| 6 import 'package:async_helper/async_helper.dart'; | 6 import 'package:async_helper/async_helper.dart'; | 
| 7 import 'package:compiler/src/closure.dart'; | 7 import 'package:compiler/src/closure.dart'; | 
| 8 import 'package:compiler/src/common.dart'; | 8 import 'package:compiler/src/common.dart'; | 
| 9 import 'package:compiler/src/compiler.dart'; | 9 import 'package:compiler/src/compiler.dart'; | 
| 10 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; | 10 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 47 /// Compute closure data mapping for [member] as a kernel based element. | 47 /// Compute closure data mapping for [member] as a kernel based element. | 
| 48 /// | 48 /// | 
| 49 /// Fills [actualMap] with the data and [sourceSpanMap] with the source spans | 49 /// Fills [actualMap] with the data and [sourceSpanMap] with the source spans | 
| 50 /// for the data origin. | 50 /// for the data origin. | 
| 51 void computeKernelClosureData(Compiler compiler, MemberEntity member, | 51 void computeKernelClosureData(Compiler compiler, MemberEntity member, | 
| 52     Map<Id, String> actualMap, Map<Id, SourceSpan> sourceSpanMap) { | 52     Map<Id, String> actualMap, Map<Id, SourceSpan> sourceSpanMap) { | 
| 53   KernelBackendStrategy backendStrategy = compiler.backendStrategy; | 53   KernelBackendStrategy backendStrategy = compiler.backendStrategy; | 
| 54   KernelToElementMapForBuilding elementMap = backendStrategy.elementMap; | 54   KernelToElementMapForBuilding elementMap = backendStrategy.elementMap; | 
| 55   GlobalLocalsMap localsMap = backendStrategy.globalLocalsMapForTesting; | 55   GlobalLocalsMap localsMap = backendStrategy.globalLocalsMapForTesting; | 
| 56   ClosureDataLookup closureDataLookup = backendStrategy.closureDataLookup; | 56   ClosureDataLookup closureDataLookup = backendStrategy.closureDataLookup; | 
|  | 57   MemberDefinition definition = elementMap.getMemberDefinition(member); | 
|  | 58   assert(definition.kind == MemberKind.regular, | 
|  | 59       failedAt(member, "Unexpected member definition $definition")); | 
| 57   new ClosureIrChecker(actualMap, sourceSpanMap, elementMap, member, | 60   new ClosureIrChecker(actualMap, sourceSpanMap, elementMap, member, | 
| 58           localsMap.getLocalsMap(member), closureDataLookup) | 61           localsMap.getLocalsMap(member), closureDataLookup) | 
| 59       .run(elementMap.getMemberNode(member)); | 62       .run(definition.node); | 
| 60 } | 63 } | 
| 61 | 64 | 
| 62 /// Ast visitor for computing closure data. | 65 /// Ast visitor for computing closure data. | 
| 63 class ClosureAstComputer extends AbstractResolvedAstComputer { | 66 class ClosureAstComputer extends AbstractResolvedAstComputer { | 
| 64   final ClosureDataLookup<ast.Node> closureDataLookup; | 67   final ClosureDataLookup<ast.Node> closureDataLookup; | 
| 65   final ClosureRepresentationInfo info; | 68   final ClosureRepresentationInfo info; | 
| 66 | 69 | 
| 67   ClosureAstComputer( | 70   ClosureAstComputer( | 
| 68       DiagnosticReporter reporter, | 71       DiagnosticReporter reporter, | 
| 69       Map<Id, String> actualMap, | 72       Map<Id, String> actualMap, | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 128 | 131 | 
| 129 /// Compute a string representation of the data stored for [local] in [info]. | 132 /// Compute a string representation of the data stored for [local] in [info]. | 
| 130 String computeLocalValue(ScopeInfo info, Local local) { | 133 String computeLocalValue(ScopeInfo info, Local local) { | 
| 131   StringBuffer sb = new StringBuffer(); | 134   StringBuffer sb = new StringBuffer(); | 
| 132   if (info.localIsUsedInTryOrSync(local)) { | 135   if (info.localIsUsedInTryOrSync(local)) { | 
| 133     sb.write('inTry'); | 136     sb.write('inTry'); | 
| 134   } | 137   } | 
| 135   // TODO(johnniwinther,efortuna): Add more info (captured, boxed etc.). | 138   // TODO(johnniwinther,efortuna): Add more info (captured, boxed etc.). | 
| 136   return sb.toString(); | 139   return sb.toString(); | 
| 137 } | 140 } | 
| OLD | NEW | 
|---|