Chromium Code Reviews

Side by Side Diff: tests/compiler/dart2js/sourcemaps/html_parts.dart

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 library sourcemap.html_parts; 5 library sourcemap.html_parts;
6 6
7 import 'sourcemap_html_helper.dart'; 7 import 'sourcemap_html_helper.dart';
8 8
9 class Annotation { 9 class Annotation {
10 final id; 10 final id;
11 final int codeOffset; 11 final int codeOffset;
12 final String title; 12 final String title;
13 final data; 13 final data;
14 14
15 Annotation(this.id, this.codeOffset, this.title, {this.data}); 15 Annotation(this.id, this.codeOffset, this.title, {this.data});
16 } 16 }
17 17
18 typedef bool AnnotationFilter(Annotation annotation); 18 typedef bool AnnotationFilter(Annotation annotation);
19 typedef AnnotationData AnnotationDataFunction( 19 typedef AnnotationData AnnotationDataFunction(Iterable<Annotation> annotations,
20 Iterable<Annotation> annotations,
21 {bool forSpan}); 20 {bool forSpan});
22 typedef LineData LineDataFunction(lineAnnotation); 21 typedef LineData LineDataFunction(lineAnnotation);
23 22
24 bool includeAllAnnotation(Annotation annotation) => true; 23 bool includeAllAnnotation(Annotation annotation) => true;
25 24
26 class LineData { 25 class LineData {
27 final String lineClass; 26 final String lineClass;
28 final String lineNumberClass; 27 final String lineNumberClass;
29 28
30 const LineData({ 29 const LineData({this.lineClass: 'line', this.lineNumberClass: 'lineNumber'});
31 this.lineClass: 'line',
32 this.lineNumberClass: 'lineNumber'});
33 } 30 }
34 31
35 class AnnotationData { 32 class AnnotationData {
36 final String tag; 33 final String tag;
37 final Map<String, String> properties; 34 final Map<String, String> properties;
38 35
39 const AnnotationData({ 36 const AnnotationData(
40 this.tag: 'a', 37 {this.tag: 'a', this.properties: const <String, String>{}});
41 this.properties: const <String, String>{}});
42 38
43 int get hashCode => tag.hashCode * 13 + properties.hashCode * 19; 39 int get hashCode => tag.hashCode * 13 + properties.hashCode * 19;
44 40
45 bool operator ==(other) { 41 bool operator ==(other) {
46 if (identical(this, other)) return true; 42 if (identical(this, other)) return true;
47 if (other is! AnnotationData) return false; 43 if (other is! AnnotationData) return false;
48 return tag == other.tag && 44 return tag == other.tag &&
49 properties.length == other.properties.length && 45 properties.length == other.properties.length &&
50 properties.keys.every((k) => properties[k] == other.properties[k]); 46 properties.keys.every((k) => properties[k] == other.properties[k]);
51 } 47 }
52 } 48 }
53 49
54 AnnotationDataFunction createAnnotationDataFunction( 50 AnnotationDataFunction createAnnotationDataFunction(
55 {CssColorScheme colorScheme: const SingleColorScheme(), 51 {CssColorScheme colorScheme: const SingleColorScheme(),
56 ElementScheme elementScheme: const ElementScheme()}) { 52 ElementScheme elementScheme: const ElementScheme()}) {
57 return (Iterable<Annotation> annotations, {bool forSpan}) { 53 return (Iterable<Annotation> annotations, {bool forSpan}) {
58 return getAnnotationDataFromSchemes( 54 return getAnnotationDataFromSchemes(annotations,
59 annotations,
60 forSpan: forSpan, 55 forSpan: forSpan,
61 colorScheme: colorScheme, 56 colorScheme: colorScheme,
62 elementScheme: elementScheme); 57 elementScheme: elementScheme);
63 }; 58 };
64 } 59 }
65 60
66 LineData getDefaultLineData(data) => const LineData(); 61 LineData getDefaultLineData(data) => const LineData();
67 62
68 AnnotationData getAnnotationDataFromSchemes( 63 AnnotationData getAnnotationDataFromSchemes(Iterable<Annotation> annotations,
69 Iterable<Annotation> annotations,
70 {bool forSpan, 64 {bool forSpan,
71 CssColorScheme colorScheme: const SingleColorScheme(), 65 CssColorScheme colorScheme: const SingleColorScheme(),
72 ElementScheme elementScheme: const ElementScheme()}) { 66 ElementScheme elementScheme: const ElementScheme()}) {
73 if (colorScheme.showLocationAsSpan != forSpan) return null; 67 if (colorScheme.showLocationAsSpan != forSpan) return null;
74 Map<String, String> data = <String, String>{}; 68 Map<String, String> data = <String, String>{};
75 var id; 69 var id;
76 if (annotations.length == 1) { 70 if (annotations.length == 1) {
77 Annotation annotation = annotations.single; 71 Annotation annotation = annotations.single;
78 if (annotation != null) { 72 if (annotation != null) {
79 id = annotation.id; 73 id = annotation.id;
80 data['style'] = colorScheme.singleLocationToCssColor(id); 74 data['style'] = colorScheme.singleLocationToCssColor(id);
81 data['title'] = annotation.title; 75 data['title'] = annotation.title;
82 } 76 }
83 } else { 77 } else {
84 id = annotations.first.id; 78 id = annotations.first.id;
85 List ids = []; 79 List ids = [];
86 for (Annotation annotation in annotations) { 80 for (Annotation annotation in annotations) {
87 ids.add(annotation.id); 81 ids.add(annotation.id);
88 } 82 }
89 data['style'] = colorScheme.multiLocationToCssColor(ids); 83 data['style'] = colorScheme.multiLocationToCssColor(ids);
90 data['title'] = annotations.map((l) => l.title).join(','); 84 data['title'] = annotations.map((l) => l.title).join(',');
91 } 85 }
92 if (id != null) { 86 if (id != null) {
93 Set ids = annotations.map((l) => l.id).toSet(); 87 Set ids = annotations.map((l) => l.id).toSet();
94 data['tag'] = 'a'; 88 data['tag'] = 'a';
95 data['name'] = elementScheme.getName(id, ids); 89 data['name'] = elementScheme.getName(id, ids);
96 data['href'] = elementScheme.getHref(id, ids); 90 data['href'] = elementScheme.getHref(id, ids);
97 data['onclick'] = elementScheme.onClick(id, ids); 91 data['onclick'] = elementScheme.onClick(id, ids);
98 data['onmouseover'] = elementScheme.onMouseOver(id, ids); 92 data['onmouseover'] = elementScheme.onMouseOver(id, ids);
99 data['onmouseout'] = elementScheme.onMouseOut(id, ids); 93 data['onmouseout'] = elementScheme.onMouseOut(id, ids);
100 return new AnnotationData( 94 return new AnnotationData(properties: data);
101 properties: data);
102 } 95 }
103 return null; 96 return null;
104 } 97 }
105 98
106 class HtmlPrintContext { 99 class HtmlPrintContext {
107 final int lineNoWidth; 100 final int lineNoWidth;
108 final bool usePre; 101 final bool usePre;
109 final AnnotationFilter includeAnnotation; 102 final AnnotationFilter includeAnnotation;
110 final AnnotationDataFunction getAnnotationData; 103 final AnnotationDataFunction getAnnotationData;
111 final LineDataFunction getLineData; 104 final LineDataFunction getLineData;
112 105
113 HtmlPrintContext({ 106 HtmlPrintContext(
114 this.lineNoWidth, 107 {this.lineNoWidth,
115 this.usePre: true, 108 this.usePre: true,
116 this.includeAnnotation: includeAllAnnotation, 109 this.includeAnnotation: includeAllAnnotation,
117 this.getAnnotationData: getAnnotationDataFromSchemes, 110 this.getAnnotationData: getAnnotationDataFromSchemes,
118 this.getLineData: getDefaultLineData}); 111 this.getLineData: getDefaultLineData});
119 112
120 HtmlPrintContext from({ 113 HtmlPrintContext from(
121 int lineNoWidth, 114 {int lineNoWidth,
122 bool usePre, 115 bool usePre,
123 AnnotationFilter includeAnnotation, 116 AnnotationFilter includeAnnotation,
124 AnnotationDataFunction getAnnotationData, 117 AnnotationDataFunction getAnnotationData,
125 LineDataFunction getLineData}) { 118 LineDataFunction getLineData}) {
126 return new HtmlPrintContext( 119 return new HtmlPrintContext(
127 lineNoWidth: lineNoWidth ?? this.lineNoWidth, 120 lineNoWidth: lineNoWidth ?? this.lineNoWidth,
128 usePre: usePre ?? this.usePre, 121 usePre: usePre ?? this.usePre,
129 includeAnnotation: includeAnnotation ?? this.includeAnnotation, 122 includeAnnotation: includeAnnotation ?? this.includeAnnotation,
130 getAnnotationData: getAnnotationData ?? this.getAnnotationData, 123 getAnnotationData: getAnnotationData ?? this.getAnnotationData,
131 getLineData: getLineData ?? this.getLineData); 124 getLineData: getLineData ?? this.getLineData);
132 } 125 }
133 } 126 }
134 127
135 enum HtmlPartKind { 128 enum HtmlPartKind { CODE, LINE, CONST, NEWLINE, TEXT, TAG, LINE_NUMBER, }
136 CODE,
137 LINE,
138 CONST,
139 NEWLINE,
140 TEXT,
141 TAG,
142 LINE_NUMBER,
143 }
144 129
145 abstract class HtmlPart { 130 abstract class HtmlPart {
146 void printHtmlOn(StringBuffer buffer, HtmlPrintContext context); 131 void printHtmlOn(StringBuffer buffer, HtmlPrintContext context);
147 132
148 HtmlPartKind get kind; 133 HtmlPartKind get kind;
149 134
150 toJson(JsonStrategy strategy); 135 toJson(JsonStrategy strategy);
151 136
152 static HtmlPart fromJson(json, JsonStrategy strategy) { 137 static HtmlPart fromJson(json, JsonStrategy strategy) {
153 if (json is String) { 138 if (json is String) {
(...skipping 77 matching lines...)
231 static HtmlText fromJson(Map json, JsonStrategy strategy) { 216 static HtmlText fromJson(Map json, JsonStrategy strategy) {
232 return new HtmlText(json['text']); 217 return new HtmlText(json['text']);
233 } 218 }
234 } 219 }
235 220
236 class TagPart implements HtmlPart { 221 class TagPart implements HtmlPart {
237 final String tag; 222 final String tag;
238 final Map<String, String> properties; 223 final Map<String, String> properties;
239 final List<HtmlPart> content; 224 final List<HtmlPart> content;
240 225
241 TagPart( 226 TagPart(this.tag,
242 this.tag, 227 {this.properties: const <String, String>{},
243 {this.properties: const <String, String>{}, 228 this.content: const <HtmlPart>[]});
244 this.content: const <HtmlPart>[]});
245 229
246 HtmlPartKind get kind => HtmlPartKind.TAG; 230 HtmlPartKind get kind => HtmlPartKind.TAG;
247 231
248 @override 232 @override
249 void printHtmlOn(StringBuffer buffer, HtmlPrintContext context) { 233 void printHtmlOn(StringBuffer buffer, HtmlPrintContext context) {
250 buffer.write('<$tag'); 234 buffer.write('<$tag');
251 properties.forEach((String key, String value) { 235 properties.forEach((String key, String value) {
252 if (value != null) { 236 if (value != null) {
253 buffer.write(' $key="${value}"'); 237 buffer.write(' $key="${value}"');
254 } 238 }
255 }); 239 });
256 buffer.write('>'); 240 buffer.write('>');
257 for (HtmlPart child in content) { 241 for (HtmlPart child in content) {
258 child.printHtmlOn(buffer, context); 242 child.printHtmlOn(buffer, context);
259 } 243 }
260 buffer.write('</$tag>'); 244 buffer.write('</$tag>');
261 } 245 }
262 246
263 toJson(JsonStrategy strategy) { 247 toJson(JsonStrategy strategy) {
264 return { 248 return {
265 'kind': kind.index, 249 'kind': kind.index,
266 'tag': tag, 250 'tag': tag,
267 'properties': properties, 251 'properties': properties,
268 'content': content.map((p) => p.toJson(strategy)).toList()}; 252 'content': content.map((p) => p.toJson(strategy)).toList()
253 };
269 } 254 }
270 255
271 static TagPart fromJson(Map json, JsonStrategy strategy) { 256 static TagPart fromJson(Map json, JsonStrategy strategy) {
272 return new TagPart( 257 return new TagPart(json['tag'],
273 json['tag'],
274 properties: json['properties'], 258 properties: json['properties'],
275 content: json['content'].map(HtmlPart.fromJson).toList()); 259 content: json['content'].map(HtmlPart.fromJson).toList());
276 } 260 }
277 } 261 }
278 262
279 class HtmlLine implements HtmlPart { 263 class HtmlLine implements HtmlPart {
280 final List<HtmlPart> htmlParts = <HtmlPart>[]; 264 final List<HtmlPart> htmlParts = <HtmlPart>[];
281 265
282 HtmlPartKind get kind => HtmlPartKind.LINE; 266 HtmlPartKind get kind => HtmlPartKind.LINE;
283 267
284 @override 268 @override
285 void printHtmlOn(StringBuffer htmlBuffer, HtmlPrintContext context) { 269 void printHtmlOn(StringBuffer htmlBuffer, HtmlPrintContext context) {
286 for (HtmlPart part in htmlParts) { 270 for (HtmlPart part in htmlParts) {
287 part.printHtmlOn(htmlBuffer, context); 271 part.printHtmlOn(htmlBuffer, context);
288 } 272 }
289 } 273 }
290 274
291 Map toJson(JsonStrategy strategy) { 275 Map toJson(JsonStrategy strategy) {
292 return { 276 return {
293 'kind': kind.index, 277 'kind': kind.index,
294 'html': htmlParts.map((p) => p.toJson(strategy)).toList(), 278 'html': htmlParts.map((p) => p.toJson(strategy)).toList(),
295 }; 279 };
296 } 280 }
297 281
298 static HtmlLine fromJson(Map json, JsonStrategy strategy) { 282 static HtmlLine fromJson(Map json, JsonStrategy strategy) {
299 HtmlLine line = new HtmlLine(); 283 HtmlLine line = new HtmlLine();
300 json['html'] 284 json['html'].forEach(
301 .forEach((part) => line.htmlParts 285 (part) => line.htmlParts.add(HtmlPart.fromJson(part, strategy)));
302 .add(HtmlPart.fromJson(part, strategy)));
303 return line; 286 return line;
304 } 287 }
305 } 288 }
306 289
307 class CodePart { 290 class CodePart {
308 final List<Annotation> annotations; 291 final List<Annotation> annotations;
309 final String subsequentCode; 292 final String subsequentCode;
310 293
311 CodePart(this.annotations, this.subsequentCode); 294 CodePart(this.annotations, this.subsequentCode);
312 295
313 void printHtmlOn(StringBuffer buffer, HtmlPrintContext context) { 296 void printHtmlOn(StringBuffer buffer, HtmlPrintContext context) {
314 Iterable<Annotation> included = 297 Iterable<Annotation> included =
315 annotations.where(context.includeAnnotation); 298 annotations.where(context.includeAnnotation);
316 299
317 List<HtmlPart> htmlParts = <HtmlPart>[]; 300 List<HtmlPart> htmlParts = <HtmlPart>[];
318 if (included.isNotEmpty) { 301 if (included.isNotEmpty) {
319 AnnotationData annotationData = 302 AnnotationData annotationData =
320 context.getAnnotationData(included, forSpan: false); 303 context.getAnnotationData(included, forSpan: false);
321 AnnotationData annotationDataForSpan = 304 AnnotationData annotationDataForSpan =
322 context.getAnnotationData(included, forSpan: true); 305 context.getAnnotationData(included, forSpan: true);
323 306
324 String head = subsequentCode; 307 String head = subsequentCode;
325 String tail = ''; 308 String tail = '';
326 if (subsequentCode.length > 1) { 309 if (subsequentCode.length > 1) {
327 head = subsequentCode.substring(0, 1); 310 head = subsequentCode.substring(0, 1);
328 tail = subsequentCode.substring(1); 311 tail = subsequentCode.substring(1);
329 } 312 }
330 313
331 void addForSpan(AnnotationData data) { 314 void addForSpan(AnnotationData data) {
332 htmlParts.add(new TagPart( 315 htmlParts.add(new TagPart(data.tag,
333 data.tag,
334 properties: data.properties, 316 properties: data.properties,
335 content: [new HtmlText(subsequentCode)])); 317 content: [new HtmlText(subsequentCode)]));
336 } 318 }
337 319
338 if (annotationData != null && 320 if (annotationData != null && annotationDataForSpan != null) {
339 annotationDataForSpan != null) { 321 htmlParts.add(new TagPart(annotationDataForSpan.tag,
340 htmlParts.add(new TagPart(
341 annotationDataForSpan.tag,
342 properties: annotationDataForSpan.properties, 322 properties: annotationDataForSpan.properties,
343 content: [ 323 content: [
344 new TagPart( 324 new TagPart(annotationData.tag,
345 annotationData.tag,
346 properties: annotationData.properties, 325 properties: annotationData.properties,
347 content: [new HtmlText(head)]), 326 content: [new HtmlText(head)]),
348 new HtmlText(tail)])); 327 new HtmlText(tail)
328 ]));
349 } else if (annotationDataForSpan != null) { 329 } else if (annotationDataForSpan != null) {
350 htmlParts.add(new TagPart( 330 htmlParts.add(new TagPart(annotationDataForSpan.tag,
351 annotationDataForSpan.tag,
352 properties: annotationDataForSpan.properties, 331 properties: annotationDataForSpan.properties,
353 content: [new HtmlText(subsequentCode)])); 332 content: [new HtmlText(subsequentCode)]));
354 } else if (annotationData != null) { 333 } else if (annotationData != null) {
355 htmlParts.add(new TagPart( 334 htmlParts.add(new TagPart(annotationData.tag,
356 annotationData.tag,
357 properties: annotationData.properties, 335 properties: annotationData.properties,
358 content: [new HtmlText(head)])); 336 content: [new HtmlText(head)]));
359 htmlParts.add(new HtmlText(tail)); 337 htmlParts.add(new HtmlText(tail));
360 } else { 338 } else {
361 htmlParts.add(new HtmlText(subsequentCode)); 339 htmlParts.add(new HtmlText(subsequentCode));
362 } 340 }
363 } else { 341 } else {
364 htmlParts.add(new HtmlText(subsequentCode)); 342 htmlParts.add(new HtmlText(subsequentCode));
365 } 343 }
366 344
367 for (HtmlPart part in htmlParts) { 345 for (HtmlPart part in htmlParts) {
368 part.printHtmlOn(buffer, context); 346 part.printHtmlOn(buffer, context);
369 } 347 }
370 } 348 }
371 349
372 Map toJson(JsonStrategy strategy) { 350 Map toJson(JsonStrategy strategy) {
373 return { 351 return {
374 'annotations': 352 'annotations':
375 annotations.map((a) => strategy.encodeAnnotation(a)).toList(), 353 annotations.map((a) => strategy.encodeAnnotation(a)).toList(),
376 'subsequentCode': subsequentCode, 354 'subsequentCode': subsequentCode,
377 }; 355 };
378 } 356 }
379 357
380 static CodePart fromJson(Map json, JsonStrategy strategy) { 358 static CodePart fromJson(Map json, JsonStrategy strategy) {
381 return new CodePart( 359 return new CodePart(
382 json['annotations'].map((j) => strategy.decodeAnnotation(j)).toList(), 360 json['annotations'].map((j) => strategy.decodeAnnotation(j)).toList(),
383 json['subsequentCode']); 361 json['subsequentCode']);
384 } 362 }
385 } 363 }
(...skipping 10 matching lines...)
396 toJson(JsonStrategy strategy) { 374 toJson(JsonStrategy strategy) {
397 return { 375 return {
398 'kind': kind.index, 376 'kind': kind.index,
399 'lineNo': lineNo, 377 'lineNo': lineNo,
400 'lineAnnotation': strategy.encodeLineAnnotation(lineAnnotation), 378 'lineAnnotation': strategy.encodeLineAnnotation(lineAnnotation),
401 }; 379 };
402 } 380 }
403 381
404 static LineNumber fromJson(Map json, JsonStrategy strategy) { 382 static LineNumber fromJson(Map json, JsonStrategy strategy) {
405 return new LineNumber( 383 return new LineNumber(
406 json['lineNo'], 384 json['lineNo'], strategy.decodeLineAnnotation(json['lineAnnotation']));
407 strategy.decodeLineAnnotation(json['lineAnnotation']));
408 } 385 }
409 386
410 @override 387 @override
411 void printHtmlOn(StringBuffer buffer, HtmlPrintContext context) { 388 void printHtmlOn(StringBuffer buffer, HtmlPrintContext context) {
412 buffer.write(lineNumber( 389 buffer.write(lineNumber(lineNo,
413 lineNo,
414 width: context.lineNoWidth, 390 width: context.lineNoWidth,
415 useNbsp: !context.usePre, 391 useNbsp: !context.usePre,
416 className: context.getLineData(lineAnnotation).lineNumberClass)); 392 className: context.getLineData(lineAnnotation).lineNumberClass));
417 } 393 }
418 } 394 }
419 395
420 class CodeLine extends HtmlPart { 396 class CodeLine extends HtmlPart {
421 final Uri uri; 397 final Uri uri;
422 final int lineNo; 398 final int lineNo;
423 final int offset; 399 final int offset;
(...skipping 31 matching lines...)
455 } 431 }
456 432
457 Map toJson(JsonStrategy strategy) { 433 Map toJson(JsonStrategy strategy) {
458 return { 434 return {
459 'kind': kind.index, 435 'kind': kind.index,
460 'lineNo': lineNo, 436 'lineNo': lineNo,
461 'offset': offset, 437 'offset': offset,
462 'code': code, 438 'code': code,
463 'parts': codeParts.map((p) => p.toJson(strategy)).toList(), 439 'parts': codeParts.map((p) => p.toJson(strategy)).toList(),
464 'annotations': 440 'annotations':
465 annotations.map((a) => strategy.encodeAnnotation(a)).toList(), 441 annotations.map((a) => strategy.encodeAnnotation(a)).toList(),
466 'lineAnnotation': lineAnnotation != null 442 'lineAnnotation': lineAnnotation != null
467 ? strategy.encodeLineAnnotation(lineAnnotation) : null, 443 ? strategy.encodeLineAnnotation(lineAnnotation)
444 : null,
468 }; 445 };
469 } 446 }
470 447
471 static CodeLine fromJson(Map json, JsonStrategy strategy) { 448 static CodeLine fromJson(Map json, JsonStrategy strategy) {
472 CodeLine line = new CodeLine( 449 CodeLine line = new CodeLine(json['lineNo'], json['offset'],
473 json['lineNo'],
474 json['offset'],
475 uri: json['uri'] != null ? Uri.parse(json['uri']) : null); 450 uri: json['uri'] != null ? Uri.parse(json['uri']) : null);
476 line.codeBuffer.write(json['code']); 451 line.codeBuffer.write(json['code']);
477 json['parts'] 452 json['parts'].forEach(
478 .forEach((part) => line.codeParts 453 (part) => line.codeParts.add(CodePart.fromJson(part, strategy)));
479 .add(CodePart.fromJson(part, strategy)));
480 json['annotations'] 454 json['annotations']
481 .forEach((a) => line.annotations 455 .forEach((a) => line.annotations.add(strategy.decodeAnnotation(a)));
482 .add(strategy.decodeAnnotation(a)));
483 line.lineAnnotation = json['lineAnnotation'] != null 456 line.lineAnnotation = json['lineAnnotation'] != null
484 ? strategy.decodeLineAnnotation(json['lineAnnotation']) : null; 457 ? strategy.decodeLineAnnotation(json['lineAnnotation'])
458 : null;
485 return line; 459 return line;
486 } 460 }
487 } 461 }
488 462
489 class JsonStrategy { 463 class JsonStrategy {
490 const JsonStrategy(); 464 const JsonStrategy();
491 465
492 Map encodeAnnotation(Annotation annotation) { 466 Map encodeAnnotation(Annotation annotation) {
493 return { 467 return {
494 'id': annotation.id, 468 'id': annotation.id,
495 'codeOffset': annotation.codeOffset, 469 'codeOffset': annotation.codeOffset,
496 'title': annotation.title, 470 'title': annotation.title,
497 'data': annotation.data, 471 'data': annotation.data,
498 }; 472 };
499 } 473 }
500 474
501 Annotation decodeAnnotation(Map json) { 475 Annotation decodeAnnotation(Map json) {
502 return new Annotation( 476 return new Annotation(json['id'], json['codeOffset'], json['title'],
503 json['id'],
504 json['codeOffset'],
505 json['title'],
506 data: json['data']); 477 data: json['data']);
507 } 478 }
508 479
509
510 encodeLineAnnotation(lineAnnotation) => lineAnnotation; 480 encodeLineAnnotation(lineAnnotation) => lineAnnotation;
511 481
512 decodeLineAnnotation(json) => json; 482 decodeLineAnnotation(json) => json;
513 } 483 }
OLDNEW

Powered by Google App Engine