 Chromium Code Reviews
 Chromium Code Reviews Issue 23898009:
  Switch polymer's build.dart to use the new linter. This CL does the following  (Closed) 
  Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
    
  
    Issue 23898009:
  Switch polymer's build.dart to use the new linter. This CL does the following  (Closed) 
  Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart| Index: pkg/polymer/lib/src/messages.dart | 
| diff --git a/pkg/polymer/lib/src/messages.dart b/pkg/polymer/lib/src/messages.dart | 
| deleted file mode 100644 | 
| index b0a5ebdc7bd4cd36408129559278abb2896bf8ff..0000000000000000000000000000000000000000 | 
| --- a/pkg/polymer/lib/src/messages.dart | 
| +++ /dev/null | 
| @@ -1,149 +0,0 @@ | 
| -// Copyright (c) 2012, 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 messages; | 
| 
Siggi Cherem (dart-lang)
2013/09/10 03:40:57
gone!
 | 
| - | 
| -import 'dart:convert'; | 
| - | 
| -import 'package:barback/barback.dart' show TransformLogger; | 
| -import 'package:source_maps/span.dart' show Span; | 
| -import 'package:logging/logging.dart' show Level; | 
| - | 
| -import 'compiler_options.dart'; | 
| -import 'utils.dart'; | 
| - | 
| -/** Map between error levels and their display color. */ | 
| -final Map<Level, String> _ERROR_COLORS = (() { | 
| - var colorsMap = new Map<Level, String>(); | 
| - colorsMap[Level.SEVERE] = RED_COLOR; | 
| - colorsMap[Level.WARNING] = MAGENTA_COLOR; | 
| - colorsMap[Level.INFO] = GREEN_COLOR; | 
| - return colorsMap; | 
| -})(); | 
| - | 
| -/** A single message from the compiler. */ | 
| -class Message { | 
| - final Level level; | 
| - final String message; | 
| - final Span span; | 
| - final bool useColors; | 
| - | 
| - Message(this.level, this.message, {this.span, this.useColors: false}); | 
| - | 
| - String get kind => level == Level.SEVERE ? 'error' : | 
| - (level == Level.WARNING ? 'warning' : 'info'); | 
| - | 
| - String toString() { | 
| - var output = new StringBuffer(); | 
| - bool colors = useColors && _ERROR_COLORS.containsKey(level); | 
| - var levelColor = _ERROR_COLORS[level]; | 
| - if (colors) output.write(levelColor); | 
| - output..write(kind)..write(' '); | 
| - if (colors) output.write(NO_COLOR); | 
| - | 
| - if (span == null) { | 
| - output.write(message); | 
| - } else { | 
| - output.write(span.getLocationMessage(message, useColors: colors, | 
| - color: levelColor)); | 
| - } | 
| - | 
| - return output.toString(); | 
| - } | 
| - | 
| - String toJson() { | 
| - if (span == null) return toString(); | 
| - return JSON.encode([{ | 
| - 'method': kind, | 
| - 'params': { | 
| - 'file': span.sourceUrl, | 
| - 'message': message, | 
| - 'line': span.start.line + 1, | 
| - 'charStart': span.start.offset, | 
| - 'charEnd': span.end.offset, | 
| - } | 
| - }]); | 
| - } | 
| -} | 
| - | 
| -/** | 
| - * This class tracks and prints information, warnings, and errors emitted by the | 
| - * compiler. | 
| - */ | 
| -class Messages implements TransformLogger { | 
| - final CompilerOptions options; | 
| - final bool shouldPrint; | 
| - | 
| - final List<Message> messages = <Message>[]; | 
| - | 
| - Messages({CompilerOptions options, this.shouldPrint: true}) | 
| - : options = options != null ? options : new CompilerOptions(); | 
| - | 
| - /** | 
| - * Creates a new instance of [Messages] which doesn't write messages to | 
| - * the console. | 
| - */ | 
| - Messages.silent(): this(shouldPrint: false); | 
| - | 
| - /** | 
| - * True if we have an error that prevents correct codegen. | 
| - * For example, if we failed to read an input file. | 
| - */ | 
| - bool get hasErrors => messages.any((m) => m.level == Level.SEVERE); | 
| - | 
| - // Convenience methods for testing | 
| - int get length => messages.length; | 
| - | 
| - Message operator[](int index) => messages[index]; | 
| - | 
| - void clear() { | 
| - messages.clear(); | 
| - } | 
| - | 
| - /** [message] is considered a static compile-time error by the Dart lang. */ | 
| - void error(String message, [Span span]) { | 
| - var msg = new Message(Level.SEVERE, message, span: span, | 
| - useColors: options.useColors); | 
| - | 
| - messages.add(msg); | 
| - printMessage(msg); | 
| - } | 
| - | 
| - /** [message] is considered a type warning by the Dart lang. */ | 
| - void warning(String message, [Span span]) { | 
| - if (options.warningsAsErrors) { | 
| - error(message, span); | 
| - } else { | 
| - var msg = new Message(Level.WARNING, message, | 
| - span: span, useColors: options.useColors); | 
| - | 
| - messages.add(msg); | 
| - printMessage(msg); | 
| - } | 
| - } | 
| - | 
| - /// the list of error messages. Empty list, if there are no error messages. | 
| - List<Message> get errors => | 
| - messages.where((m) => m.level == Level.SEVERE).toList(); | 
| - | 
| - /// the list of warning messages. Empty list if there are no warning messages. | 
| - List<Message> get warnings => | 
| - messages.where((m) => m.level == Level.WARNING).toList(); | 
| - | 
| - /** | 
| - * [message] at [span] will tell the user about what the compiler | 
| - * is doing. | 
| - */ | 
| - void info(String message, [Span span]) { | 
| - var msg = new Message(Level.INFO, message, span: span, | 
| - useColors: options.useColors); | 
| - | 
| - messages.add(msg); | 
| - if (options.verbose) printMessage(msg); | 
| - } | 
| - | 
| - void printMessage(msg) { | 
| - if (shouldPrint) print(options.jsonFormat ? msg.toJson() : msg); | 
| - } | 
| -} |