Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 class WorkItem { | 5 class WorkItem { |
| 6 final Element element; | 6 final Element element; |
| 7 TreeElements resolutionTree; | 7 TreeElements resolutionTree; |
| 8 Function run; | 8 Function run; |
| 9 Map<int, BailoutInfo> bailouts = null; | 9 Map<int, BailoutInfo> bailouts = null; |
| 10 bool allowSpeculativeOptimization = true; | 10 bool allowSpeculativeOptimization = true; |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 369 SourceSpan spanFromTokens(Token begin, Token end) { | 369 SourceSpan spanFromTokens(Token begin, Token end) { |
| 370 if (begin === null || end === null) { | 370 if (begin === null || end === null) { |
| 371 // TODO(ahe): We can almost always do better. Often it is only | 371 // TODO(ahe): We can almost always do better. Often it is only |
| 372 // end that is null. Otherwise, we probably know the current | 372 // end that is null. Otherwise, we probably know the current |
| 373 // URI. | 373 // URI. |
| 374 throw 'cannot find tokens to produce error message'; | 374 throw 'cannot find tokens to produce error message'; |
| 375 } | 375 } |
| 376 final startOffset = begin.charOffset; | 376 final startOffset = begin.charOffset; |
| 377 // TODO(ahe): Compute proper end offset. | 377 // TODO(ahe): Compute proper end offset. |
| 378 final endOffset = | 378 final endOffset = |
| 379 (end.next !== null) ? end.next.charOffset : startOffset + 1; | 379 Math.max((end.next !== null) ? end.next.charOffset : 0, startOffset + 1); |
|
kasperl
2012/03/13 08:55:30
It's a bit hard to read and understand this line n
ahe
2012/03/13 09:12:11
Done.
| |
| 380 Uri uri = currentElement.getCompilationUnit().script.uri; | 380 Uri uri = currentElement.getCompilationUnit().script.uri; |
| 381 return new SourceSpan(uri, startOffset, endOffset); | 381 return new SourceSpan(uri, startOffset, endOffset); |
| 382 } | 382 } |
| 383 | 383 |
| 384 SourceSpan spanFromNode(Node node) { | 384 SourceSpan spanFromNode(Node node) { |
| 385 return spanFromTokens(node.getBeginToken(), node.getEndToken()); | 385 return spanFromTokens(node.getBeginToken(), node.getEndToken()); |
| 386 } | 386 } |
| 387 | 387 |
| 388 SourceSpan spanFromElement(Element element) { | 388 SourceSpan spanFromElement(Element element) { |
| 389 if (element.position() === null) { | 389 if (element.position() === null) { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 470 } | 470 } |
| 471 } | 471 } |
| 472 | 472 |
| 473 class SourceSpan { | 473 class SourceSpan { |
| 474 final Uri uri; | 474 final Uri uri; |
| 475 final int begin; | 475 final int begin; |
| 476 final int end; | 476 final int end; |
| 477 | 477 |
| 478 const SourceSpan(this.uri, this.begin, this.end); | 478 const SourceSpan(this.uri, this.begin, this.end); |
| 479 } | 479 } |
| OLD | NEW |