Chromium Code Reviews| Index: pkg/compiler/lib/src/io/position_information.dart |
| diff --git a/pkg/compiler/lib/src/io/position_information.dart b/pkg/compiler/lib/src/io/position_information.dart |
| index 896676389d84d665dc5d383c39a3c4bd332eb5f5..c72be785052499f28ad776117ef76644f756356e 100644 |
| --- a/pkg/compiler/lib/src/io/position_information.dart |
| +++ b/pkg/compiler/lib/src/io/position_information.dart |
| @@ -163,7 +163,8 @@ class PositionSourceInformationBuilder implements SourceInformationBuilder { |
| sourceFile, element.position.charOffset, name)); |
| } else { |
| return new PositionSourceInformation( |
| - null, |
| + new OffsetSourceLocation(sourceFile, |
| + element.resolvedAst.node.getBeginToken().charOffset, name), |
| new OffsetSourceLocation(sourceFile, |
| element.resolvedAst.node.getEndToken().charOffset, name)); |
| } |
| @@ -501,15 +502,28 @@ class PositionTraceListener extends TraceListener with |
| SourceInformation sourceInformation = computeSourceInformation(node); |
| if (sourceInformation == null) return; |
| - SourcePositionKind sourcePositionKind = SourcePositionKind.START; |
| + void registerPosition(SourcePositionKind sourcePositionKind) { |
| + int codeLocation = offset.subexpressionOffset; |
|
Siggi Cherem (dart-lang)
2016/03/07 18:12:49
consider moving this out to the beginning of onSte
Johnni Winther
2016/03/08 09:39:23
Done.
|
| + SourceLocation sourceLocation = |
| + getSourceLocation(sourceInformation, sourcePositionKind); |
| + if (codeLocation != null && sourceLocation != null) { |
| + sourceMapper.register(node, codeLocation, sourceLocation); |
| + } |
| + } |
| + |
| switch (kind) { |
| - case StepKind.FUN: |
| - sourcePositionKind = SourcePositionKind.INNER; |
| + case StepKind.FUN_ENTRY: |
| + // TODO(johnniwinther): Remove this when fully transitioned to the |
| + // new source info system. |
| + registerPosition(SourcePositionKind.START); |
| + break; |
| + case StepKind.FUN_EXIT: |
| + registerPosition(SourcePositionKind.INNER); |
| break; |
| case StepKind.CALL: |
| CallPosition callPosition = |
| CallPosition.getSemanticPositionForCall(node); |
| - sourcePositionKind = callPosition.sourcePositionKind; |
| + registerPosition(callPosition.sourcePositionKind); |
| break; |
| case StepKind.NEW: |
| case StepKind.RETURN: |
| @@ -524,14 +538,9 @@ class PositionTraceListener extends TraceListener with |
| case StepKind.WHILE_CONDITION: |
| case StepKind.DO_CONDITION: |
| case StepKind.SWITCH_EXPRESSION: |
| + registerPosition(SourcePositionKind.START); |
| break; |
| } |
| - int codeLocation = offset.subexpressionOffset; |
| - SourceLocation sourceLocation = |
| - getSourceLocation(sourceInformation, sourcePositionKind); |
| - if (codeLocation != null && sourceLocation != null) { |
| - sourceMapper.register(node, codeLocation, sourceLocation); |
| - } |
| } |
| } |
| @@ -672,7 +681,8 @@ enum BranchKind { |
| } |
| enum StepKind { |
| - FUN, |
| + FUN_ENTRY, |
| + FUN_EXIT, |
| CALL, |
| NEW, |
| RETURN, |
| @@ -797,11 +807,17 @@ class JavaScriptTracer extends js.BaseVisitor { |
| if (!active) { |
| active = node.sourceInformation != null; |
| } |
| + leftToRightOffset = statementOffset = |
| + getSyntaxOffset(node, kind: CodePositionKind.START); |
| + Offset entryOffset = getOffsetForNode(node, statementOffset); |
| + notifyStep(node, entryOffset, StepKind.FUN_ENTRY); |
| + |
| visit(node.body); |
| + |
| leftToRightOffset = statementOffset = |
| getSyntaxOffset(node, kind: CodePositionKind.CLOSING); |
| - Offset offset = getOffsetForNode(node, statementOffset); |
| - notifyStep(node, offset, StepKind.FUN); |
| + Offset exitOffset = getOffsetForNode(node, statementOffset); |
| + notifyStep(node, exitOffset, StepKind.FUN_EXIT); |
| active = activeBefore; |
| } |