Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1590)

Side by Side Diff: pkg/source_maps/lib/parser.dart

Issue 781643002: Removing unnecessary warning when parsing Json. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/source_maps/CHANGELOG.md ('k') | pkg/source_maps/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 /// Contains the top-level function to parse source maps version 3. 5 /// Contains the top-level function to parse source maps version 3.
6 library source_maps.parser; 6 library source_maps.parser;
7 7
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:convert'; 9 import 'dart:convert';
10 10
(...skipping 13 matching lines...) Expand all
24 parseJson(JSON.decode(jsonMap), otherMaps: otherMaps); 24 parseJson(JSON.decode(jsonMap), otherMaps: otherMaps);
25 25
26 /// Parses a source map directly from a json map object. 26 /// Parses a source map directly from a json map object.
27 Mapping parseJson(Map map, {Map<String, Map> otherMaps}) { 27 Mapping parseJson(Map map, {Map<String, Map> otherMaps}) {
28 if (map['version'] != 3) { 28 if (map['version'] != 3) {
29 throw new ArgumentError( 29 throw new ArgumentError(
30 'unexpected source map version: ${map["version"]}. ' 30 'unexpected source map version: ${map["version"]}. '
31 'Only version 3 is supported.'); 31 'Only version 3 is supported.');
32 } 32 }
33 33
34 if (!map.containsKey('file')) {
Siggi Cherem (dart-lang) 2014/12/04 00:12:23 oh cool - it seems they made it optional about a y
35 print('warning: missing "file" entry in source map');
36 }
37
38 if (map.containsKey('sections')) { 34 if (map.containsKey('sections')) {
39 if (map.containsKey('mappings') || map.containsKey('sources') || 35 if (map.containsKey('mappings') || map.containsKey('sources') ||
40 map.containsKey('names')) { 36 map.containsKey('names')) {
41 throw new FormatException('map containing "sections" ' 37 throw new FormatException('map containing "sections" '
42 'cannot contain "mappings", "sources", or "names".'); 38 'cannot contain "mappings", "sources", or "names".');
43 } 39 }
44 return new MultiSectionMapping.fromJson(map['sections'], otherMaps); 40 return new MultiSectionMapping.fromJson(map['sections'], otherMaps);
45 } 41 }
46 return new SingleMapping.fromJson(map); 42 return new SingleMapping.fromJson(map);
47 } 43 }
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 static const _TokenKind EOF = const _TokenKind(isEof: true); 505 static const _TokenKind EOF = const _TokenKind(isEof: true);
510 static const _TokenKind VALUE = const _TokenKind(); 506 static const _TokenKind VALUE = const _TokenKind();
511 final bool isNewLine; 507 final bool isNewLine;
512 final bool isNewSegment; 508 final bool isNewSegment;
513 final bool isEof; 509 final bool isEof;
514 bool get isValue => !isNewLine && !isNewSegment && !isEof; 510 bool get isValue => !isNewLine && !isNewSegment && !isEof;
515 511
516 const _TokenKind( 512 const _TokenKind(
517 {this.isNewLine: false, this.isNewSegment: false, this.isEof: false}); 513 {this.isNewLine: false, this.isNewSegment: false, this.isEof: false});
518 } 514 }
OLDNEW
« no previous file with comments | « pkg/source_maps/CHANGELOG.md ('k') | pkg/source_maps/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698