-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
svn merge -r 25973:25988 https://dart.googlecode.com/svn/branches/bleeding_edge trunk git-svn-id: http://dart.googlecode.com/svn/trunk@25990 260f80e4-7a28-3924-810f-c04153c831b5
- Loading branch information
Showing
44 changed files
with
1,333 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
library barback.transform_logger; | ||
|
||
import 'package:source_maps/span.dart'; | ||
|
||
/// Object used to report warnings and errors encountered while running a | ||
/// transformer. | ||
class TransformLogger { | ||
|
||
bool _shouldPrint; | ||
|
||
TransformLogger(this._shouldPrint); | ||
|
||
/// Logs a warning message. | ||
/// | ||
/// If present, [span] indicates the location in the input asset that caused | ||
/// the warning. | ||
void warning(String message, [Span span]) { | ||
_printMessage('warning', message, span); | ||
} | ||
|
||
/// Logs an error message. | ||
/// | ||
/// If present, [span] indicates the location in the input asset that caused | ||
/// the error. | ||
// TODO(sigmund,nweiz): clarify when an error should be logged or thrown. | ||
void error(String message, [Span span]) { | ||
_printMessage('error', message, span); | ||
} | ||
|
||
// TODO(sigmund,rnystrom): do something better than printing. | ||
_printMessage(String prefix, String message, Span span) { | ||
if (!_shouldPrint) return; | ||
print(span == null ? '$prefix $message' | ||
: '$prefix ${span.getLocationMessage(message)}'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.