| Index: pkg/compiler/lib/src/kernel/element_map.dart
 | 
| diff --git a/pkg/compiler/lib/src/kernel/element_map.dart b/pkg/compiler/lib/src/kernel/element_map.dart
 | 
| index dfa6ae18ec7d54f3d1aecd30be165109367538d8..bf1dd2787cdc7cf1cbd139944f1ae8b22f4e6078 100644
 | 
| --- a/pkg/compiler/lib/src/kernel/element_map.dart
 | 
| +++ b/pkg/compiler/lib/src/kernel/element_map.dart
 | 
| @@ -231,7 +231,7 @@ abstract class MemberDefinition {
 | 
|  
 | 
|    /// The canonical location of [member]. This is used for sorting the members
 | 
|    /// in the emitted code.
 | 
| -  ir.Location get location;
 | 
| +  SourceSpan get location;
 | 
|  }
 | 
|  
 | 
|  enum ClassKind {
 | 
| @@ -246,7 +246,7 @@ class RegularMemberDefinition implements MemberDefinition {
 | 
|  
 | 
|    RegularMemberDefinition(this.member, this.node);
 | 
|  
 | 
| -  ir.Location get location => node.location;
 | 
| +  SourceSpan get location => computeSourceSpanFromTreeNode(node);
 | 
|  
 | 
|    MemberKind get kind => MemberKind.regular;
 | 
|  
 | 
| @@ -262,7 +262,7 @@ class SpecialMemberDefinition implements MemberDefinition {
 | 
|  
 | 
|    SpecialMemberDefinition(this.member, this.node, this.kind);
 | 
|  
 | 
| -  ir.Location get location => node.location;
 | 
| +  SourceSpan get location => computeSourceSpanFromTreeNode(node);
 | 
|  
 | 
|    String toString() => 'SpecialMemberDefinition(kind:$kind,member:$member,'
 | 
|        'node:$node,location:$location)';
 | 
| @@ -281,7 +281,7 @@ abstract class ClassDefinition {
 | 
|  
 | 
|    /// The canonical location of [cls]. This is used for sorting the classes
 | 
|    /// in the emitted code.
 | 
| -  ir.Location get location;
 | 
| +  SourceSpan get location;
 | 
|  }
 | 
|  
 | 
|  /// A class directly defined by its [ir.Class] node.
 | 
| @@ -291,7 +291,7 @@ class RegularClassDefinition implements ClassDefinition {
 | 
|  
 | 
|    RegularClassDefinition(this.cls, this.node);
 | 
|  
 | 
| -  ir.Location get location => node.location;
 | 
| +  SourceSpan get location => computeSourceSpanFromTreeNode(node);
 | 
|  
 | 
|    ClassKind get kind => ClassKind.regular;
 | 
|  
 | 
| @@ -431,3 +431,21 @@ abstract class KernelToLocalsMap {
 | 
|  int namedOrdering(ir.VariableDeclaration a, ir.VariableDeclaration b) {
 | 
|    return a.name.compareTo(b.name);
 | 
|  }
 | 
| +
 | 
| +SourceSpan computeSourceSpanFromTreeNode(ir.TreeNode node) {
 | 
| +  // TODO(johnniwinther): Use [ir.Location] directly as a [SourceSpan].
 | 
| +  Uri uri;
 | 
| +  int offset;
 | 
| +  while (node != null) {
 | 
| +    if (node.fileOffset != ir.TreeNode.noOffset) {
 | 
| +      offset = node.fileOffset;
 | 
| +      uri = Uri.parse(node.location.file);
 | 
| +      break;
 | 
| +    }
 | 
| +    node = node.parent;
 | 
| +  }
 | 
| +  if (uri != null) {
 | 
| +    return new SourceSpan(uri, offset, offset + 1);
 | 
| +  }
 | 
| +  return null;
 | 
| +}
 | 
| 
 |