OLD | NEW |
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 library script_inset_element; | 5 library script_inset_element; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'observatory_element.dart'; | 9 import 'observatory_element.dart'; |
10 import 'service_ref.dart'; | 10 import 'service_ref.dart'; |
(...skipping 25 matching lines...) Expand all Loading... |
36 if (infoBox == null) buildInfoBox(); // Created lazily on the first click. | 36 if (infoBox == null) buildInfoBox(); // Created lazily on the first click. |
37 infoBox.style.display = show ? 'block' : 'none'; | 37 infoBox.style.display = show ? 'block' : 'none'; |
38 content.style.backgroundColor = show ? 'white' : originalBackground; | 38 content.style.backgroundColor = show ? 'white' : originalBackground; |
39 }); | 39 }); |
40 | 40 |
41 // Causes infoBox to be positioned relative to the bottom-left of content. | 41 // Causes infoBox to be positioned relative to the bottom-left of content. |
42 content.style.display = 'inline-block'; | 42 content.style.display = 'inline-block'; |
43 content.style.cursor = 'pointer'; | 43 content.style.cursor = 'pointer'; |
44 } | 44 } |
45 | 45 |
| 46 |
| 47 void addLink(Element content, String target) { |
| 48 // Ick, destructive but still compatible with also adding an info box. |
| 49 var a = new AnchorElement(href: target); |
| 50 a.text = content.text; |
| 51 content.text = ''; |
| 52 content.append(a); |
| 53 } |
| 54 |
| 55 |
46 abstract class Annotation implements Comparable<Annotation> { | 56 abstract class Annotation implements Comparable<Annotation> { |
47 int line; | 57 int line; |
48 int columnStart; | 58 int columnStart; |
49 int columnStop; | 59 int columnStop; |
50 | 60 |
51 void applyStyleTo(element); | 61 void applyStyleTo(element); |
52 | 62 |
53 int compareTo(Annotation other) { | 63 int compareTo(Annotation other) { |
54 if (line == other.line) { | 64 if (line == other.line) { |
55 return columnStart.compareTo(other.columnStart); | 65 return columnStart.compareTo(other.columnStart); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 if (element == null) { | 104 if (element == null) { |
95 return; // TODO(rmacnak): Handling overlapping annotations. | 105 return; // TODO(rmacnak): Handling overlapping annotations. |
96 } | 106 } |
97 element.classes.add("currentCol"); | 107 element.classes.add("currentCol"); |
98 element.title = "Current execution"; | 108 element.title = "Current execution"; |
99 } | 109 } |
100 } | 110 } |
101 | 111 |
102 class LibraryAnnotation extends Annotation { | 112 class LibraryAnnotation extends Annotation { |
103 Library target; | 113 Library target; |
104 LibraryAnnotation(this.target); | 114 String url; |
| 115 LibraryAnnotation(this.target, this.url); |
105 | 116 |
106 void applyStyleTo(element) { | 117 void applyStyleTo(element) { |
107 if (element == null) { | 118 if (element == null) { |
108 return; // TODO(rmacnak): Handling overlapping annotations. | 119 return; // TODO(rmacnak): Handling overlapping annotations. |
109 } | 120 } |
110 element.style.fontWeight = "bold"; | |
111 element.title = "library ${target.uri}"; | 121 element.title = "library ${target.uri}"; |
112 | 122 addLink(element, url); |
113 addInfoBox(element, () { | |
114 var details = table(); | |
115 var r = row(); | |
116 r.append(cell("Library")); | |
117 r.append(cell(serviceRef(target))); | |
118 details.append(r); | |
119 | |
120 return details; | |
121 }); | |
122 } | 123 } |
123 } | 124 } |
124 | 125 |
125 class PartAnnotation extends Annotation { | 126 class PartAnnotation extends Annotation { |
126 Script part; | 127 Script part; |
127 PartAnnotation(this.part); | 128 String url; |
| 129 PartAnnotation(this.part, this.url); |
128 | 130 |
129 void applyStyleTo(element) { | 131 void applyStyleTo(element) { |
130 if (element == null) { | 132 if (element == null) { |
131 return; // TODO(rmacnak): Handling overlapping annotations. | 133 return; // TODO(rmacnak): Handling overlapping annotations. |
132 } | 134 } |
133 element.style.fontWeight = "bold"; | |
134 element.title = "script ${part.uri}"; | 135 element.title = "script ${part.uri}"; |
135 | 136 addLink(element, url); |
136 addInfoBox(element, () { | |
137 var details = table(); | |
138 var r = row(); | |
139 r.append(cell("Script")); | |
140 r.append(cell(serviceRef(part))); | |
141 details.append(r); | |
142 | |
143 return details; | |
144 }); | |
145 } | 137 } |
146 } | 138 } |
147 | 139 |
148 class LocalVariableAnnotation extends Annotation { | 140 class LocalVariableAnnotation extends Annotation { |
149 final value; | 141 final value; |
150 | 142 |
151 LocalVariableAnnotation(LocalVarLocation location, this.value) { | 143 LocalVariableAnnotation(LocalVarLocation location, this.value) { |
152 line = location.line; | 144 line = location.line; |
153 columnStart = location.column; | 145 columnStart = location.column; |
154 columnStop = location.endColumn; | 146 columnStop = location.endColumn; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 r.append(cell(serviceRef(entry.target))); | 192 r.append(cell(serviceRef(entry.target))); |
201 details.append(r); | 193 details.append(r); |
202 } | 194 } |
203 } | 195 } |
204 return details; | 196 return details; |
205 }); | 197 }); |
206 } | 198 } |
207 } | 199 } |
208 | 200 |
209 abstract class DeclarationAnnotation extends Annotation { | 201 abstract class DeclarationAnnotation extends Annotation { |
210 DeclarationAnnotation(decl) { | 202 String url; |
| 203 DeclarationAnnotation(decl, this.url) { |
211 assert(decl.loaded); | 204 assert(decl.loaded); |
212 SourceLocation location = decl.location; | 205 SourceLocation location = decl.location; |
213 if (location == null) { | 206 if (location == null) { |
214 line = 0; | 207 line = 0; |
215 columnStart = 0; | 208 columnStart = 0; |
216 columnStop = 0; | 209 columnStop = 0; |
217 return; | 210 return; |
218 } | 211 } |
219 | 212 |
220 Script script = location.script; | 213 Script script = location.script; |
(...skipping 16 matching lines...) Expand all Loading... |
237 columnStart = betterStart; | 230 columnStart = betterStart; |
238 } | 231 } |
239 columnStop = columnStart + decl.name.length; | 232 columnStop = columnStart + decl.name.length; |
240 } | 233 } |
241 } | 234 } |
242 } | 235 } |
243 | 236 |
244 class ClassDeclarationAnnotation extends DeclarationAnnotation { | 237 class ClassDeclarationAnnotation extends DeclarationAnnotation { |
245 Class klass; | 238 Class klass; |
246 | 239 |
247 ClassDeclarationAnnotation(Class cls) : klass = cls, super(cls); | 240 ClassDeclarationAnnotation(Class cls, String url) |
| 241 : klass = cls, |
| 242 super(cls, url); |
248 | 243 |
249 void applyStyleTo(element) { | 244 void applyStyleTo(element) { |
250 if (element == null) { | 245 if (element == null) { |
251 return; // TODO(rmacnak): Handling overlapping annotations. | 246 return; // TODO(rmacnak): Handling overlapping annotations. |
252 } | 247 } |
253 element.style.fontWeight = "bold"; | |
254 element.title = "class ${klass.name}"; | 248 element.title = "class ${klass.name}"; |
255 | 249 addLink(element, url); |
256 addInfoBox(element, () { | |
257 var details = table(); | |
258 var r = row(); | |
259 r.append(cell("Class")); | |
260 r.append(cell(serviceRef(klass))); | |
261 details.append(r); | |
262 | |
263 return details; | |
264 }); | |
265 } | 250 } |
266 } | 251 } |
267 | 252 |
268 class FieldDeclarationAnnotation extends DeclarationAnnotation { | 253 class FieldDeclarationAnnotation extends DeclarationAnnotation { |
269 Field field; | 254 Field field; |
270 | 255 |
271 FieldDeclarationAnnotation(Field fld) : field = fld, super(fld); | 256 FieldDeclarationAnnotation(Field fld, String url) |
| 257 : field = fld, |
| 258 super(fld, url); |
272 | 259 |
273 void applyStyleTo(element) { | 260 void applyStyleTo(element) { |
274 if (element == null) { | 261 if (element == null) { |
275 return; // TODO(rmacnak): Handling overlapping annotations. | 262 return; // TODO(rmacnak): Handling overlapping annotations. |
276 } | 263 } |
277 element.style.fontWeight = "bold"; | 264 var tooltip = "field ${field.name}"; |
278 element.title = "field ${field.name}"; | 265 element.title = tooltip; |
279 | 266 addLink(element, url); |
280 addInfoBox(element, () { | |
281 var details = table(); | |
282 var r = row(); | |
283 r.append(cell("Field")); | |
284 r.append(cell(serviceRef(field))); | |
285 details.append(r); | |
286 | |
287 if (field.isStatic) { | |
288 if (field.loaded) { | |
289 r = row(); | |
290 r.append(cell("Value")); | |
291 r.append(cell(serviceRef(field.staticValue))); | |
292 details.append(r); | |
293 } | |
294 } else { | |
295 r = row(); | |
296 r.append(cell("Nullable")); | |
297 r.append(cell(field.guardNullable ? "null observed" | |
298 : "null not observed")); | |
299 details.append(r); | |
300 | |
301 r = row(); | |
302 r.append(cell("Types")); | |
303 if (field.guardClass == "dynamic") { | |
304 r.append(cell("various")); | |
305 } else if (field.guardClass == "unknown") { | |
306 r.append(cell("none")); | |
307 } else { | |
308 r.append(cell(serviceRef(field.guardClass))); | |
309 } | |
310 details.append(r); | |
311 } | |
312 | |
313 return details; | |
314 }); | |
315 } | 267 } |
316 } | 268 } |
317 | 269 |
318 class FunctionDeclarationAnnotation extends DeclarationAnnotation { | 270 class FunctionDeclarationAnnotation extends DeclarationAnnotation { |
319 ServiceFunction function; | 271 ServiceFunction function; |
320 | 272 |
321 FunctionDeclarationAnnotation(ServiceFunction func) | 273 FunctionDeclarationAnnotation(ServiceFunction func, String url) |
322 : function = func, super(func); | 274 : function = func, |
| 275 super(func, url); |
323 | 276 |
324 void applyStyleTo(element) { | 277 void applyStyleTo(element) { |
325 if (element == null) { | 278 if (element == null) { |
326 return; // TODO(rmacnak): Handling overlapping annotations. | 279 return; // TODO(rmacnak): Handling overlapping annotations. |
327 } | 280 } |
328 element.style.fontWeight = "bold"; | 281 var tooltip = "method ${function.name}"; |
329 element.title = "method ${function.name}"; | 282 if (function.isOptimizable == false) { |
| 283 tooltip += "\nUnoptimizable!"; |
| 284 } |
| 285 if (function.isInlinable == false) { |
| 286 tooltip += "\nNot inlinable!"; |
| 287 } |
| 288 if (function.deoptimizations > 0) { |
| 289 tooltip += "\nDeoptimized ${function.deoptimizations} times!"; |
| 290 } |
| 291 element.title = tooltip; |
330 | 292 |
331 if (function.isOptimizable == false || | 293 if (function.isOptimizable == false || |
332 function.isInlinable == false || | 294 function.isInlinable == false || |
333 function.deoptimizations >0) { | 295 function.deoptimizations >0) { |
334 element.style.backgroundColor = "red"; | 296 element.style.backgroundColor = "red"; |
335 } | 297 } |
336 | 298 |
337 addInfoBox(element, () { | 299 addLink(element, url); |
338 var details = table(); | |
339 var r = row(); | |
340 r.append(cell("Function")); | |
341 r.append(cell(serviceRef(function))); | |
342 details.append(r); | |
343 | |
344 r = row(); | |
345 r.append(cell("Usage Count")); | |
346 r.append(cell("${function.usageCounter}")); | |
347 details.append(r); | |
348 | |
349 if (function.isOptimizable == false) { | |
350 details.append(row(cell("Unoptimizable!"))); | |
351 } | |
352 if (function.isInlinable == false) { | |
353 details.append(row(cell("Not inlinable!"))); | |
354 } | |
355 if (function.deoptimizations > 0) { | |
356 details.append(row("Deoptimized ${function.deoptimizations} times!")); | |
357 } | |
358 return details; | |
359 }); | |
360 } | 300 } |
361 } | 301 } |
362 | 302 |
363 /// Box with script source code in it. | 303 /// Box with script source code in it. |
364 @CustomTag('script-inset') | 304 @CustomTag('script-inset') |
365 class ScriptInsetElement extends ObservatoryElement { | 305 class ScriptInsetElement extends ObservatoryElement { |
366 @published Script script; | 306 @published Script script; |
367 @published int startPos; | 307 @published int startPos; |
368 @published int endPos; | 308 @published int endPos; |
369 | 309 |
370 /// Set the height to make the script inset scroll. Otherwise it | 310 /// Set the height to make the script inset scroll. Otherwise it |
371 /// will show from startPos to endPos. | 311 /// will show from startPos to endPos. |
372 @published String height = null; | 312 @published String height = null; |
373 | 313 |
374 @published int currentPos; | 314 @published int currentPos; |
375 @published bool inDebuggerContext = false; | 315 @published bool inDebuggerContext = false; |
376 @published ObservableList variables; | 316 @published ObservableList variables; |
377 | 317 |
378 int _currentLine; | 318 int _currentLine; |
379 int _currentCol; | 319 int _currentCol; |
380 int _startLine; | 320 int _startLine; |
381 int _endLine; | 321 int _endLine; |
382 | 322 |
383 var annotations = []; | 323 var annotations = []; |
384 var annotationsCursor; | 324 var annotationsCursor; |
385 | 325 |
386 StreamSubscription scriptChangeSubscription; | 326 StreamSubscription scriptChangeSubscription; |
387 | 327 |
| 328 bool hasLoadedLibraryDeclarations = false; |
| 329 |
388 String makeLineId(int line) { | 330 String makeLineId(int line) { |
389 return 'line-$line'; | 331 return 'line-$line'; |
390 } | 332 } |
391 | 333 |
392 void _scrollToCurrentPos() { | 334 void _scrollToCurrentPos() { |
393 var line = querySelector('#${makeLineId(_currentLine)}'); | 335 var line = querySelector('#${makeLineId(_currentLine)}'); |
394 if (line != null) { | 336 if (line != null) { |
395 line.scrollIntoView(); | 337 line.scrollIntoView(); |
396 } | 338 } |
397 } | 339 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 | 437 |
496 _endLine = (endPos != null | 438 _endLine = (endPos != null |
497 ? script.tokenToLine(endPos) | 439 ? script.tokenToLine(endPos) |
498 : script.lines.length + script.lineOffset); | 440 : script.lines.length + script.lineOffset); |
499 | 441 |
500 annotations.clear(); | 442 annotations.clear(); |
501 | 443 |
502 addCurrentExecutionAnnotation(); | 444 addCurrentExecutionAnnotation(); |
503 | 445 |
504 if (!inDebuggerContext && script.library != null) { | 446 if (!inDebuggerContext && script.library != null) { |
505 loadDeclarationsOfLibrary(script.library); | 447 if (hasLoadedLibraryDeclarations) { |
506 addLibraryAnnotations(); | 448 addLibraryAnnotations(); |
507 addDependencyAnnotations(); | 449 addDependencyAnnotations(); |
508 addPartAnnotations(); | 450 addPartAnnotations(); |
509 addClassAnnotations(); | 451 addClassAnnotations(); |
510 addFieldAnnotations(); | 452 addFieldAnnotations(); |
511 addFunctionAnnotations(); | 453 addFunctionAnnotations(); |
512 addCallSiteAnnotations(); | 454 addCallSiteAnnotations(); |
| 455 } else { |
| 456 loadDeclarationsOfLibrary(script.library).then((_) { |
| 457 hasLoadedLibraryDeclarations = true; |
| 458 update(); |
| 459 }); |
| 460 } |
513 } | 461 } |
514 | 462 |
515 addLocalVariableAnnotations(); | 463 addLocalVariableAnnotations(); |
516 | 464 |
517 annotations.sort(); | 465 annotations.sort(); |
518 } | 466 } |
519 | 467 |
520 void addCurrentExecutionAnnotation() { | 468 void addCurrentExecutionAnnotation() { |
521 if (_currentLine != null) { | 469 if (_currentLine != null) { |
522 var a = new CurrentExecutionAnnotation(); | 470 var a = new CurrentExecutionAnnotation(); |
523 a.line = _currentLine; | 471 a.line = _currentLine; |
524 a.columnStart = _currentCol; | 472 a.columnStart = _currentCol; |
525 a.columnStop = _currentCol + 1; | 473 a.columnStop = _currentCol + 1; |
526 annotations.add(a); | 474 annotations.add(a); |
527 } | 475 } |
528 } | 476 } |
529 | 477 |
530 void loadDeclarationsOfLibrary(Library lib) { | 478 Future loadDeclarationsOfLibrary(Library lib) { |
531 lib.load().then((lib) { | 479 return lib.load().then((lib) { |
| 480 var loads = []; |
532 for (var func in lib.functions) { | 481 for (var func in lib.functions) { |
533 func.load(); | 482 loads.add(func.load()); |
534 } | 483 } |
535 for (var field in lib.variables) { | 484 for (var field in lib.variables) { |
536 field.load(); | 485 loads.add(field.load()); |
537 } | 486 } |
538 for (var cls in lib.classes) { | 487 for (var cls in lib.classes) { |
539 cls.load().then((cls) { | 488 loads.add(loadDeclarationsOfClass(cls)); |
540 for (var func in cls.functions) { | |
541 func.load(); | |
542 } | |
543 for (var field in cls.fields) { | |
544 field.load(); | |
545 } | |
546 }); | |
547 } | 489 } |
| 490 return Future.wait(loads); |
548 }); | 491 }); |
549 } | 492 } |
550 | 493 |
| 494 Future loadDeclarationsOfClass(Class cls) { |
| 495 return cls.load().then((cls) { |
| 496 var loads = []; |
| 497 for (var func in cls.functions) { |
| 498 loads.add(func.load()); |
| 499 } |
| 500 for (var field in cls.fields) { |
| 501 loads.add(field.load()); |
| 502 } |
| 503 return Future.wait(loads); |
| 504 }); |
| 505 } |
| 506 |
| 507 String inspectLink(ServiceObject ref) { |
| 508 return gotoLink('/inspect', ref); |
| 509 } |
| 510 |
551 void addLibraryAnnotations() { | 511 void addLibraryAnnotations() { |
552 for (ScriptLine line in script.lines) { | 512 for (ScriptLine line in script.lines) { |
553 // TODO(rmacnak): Use a real scanner. | 513 // TODO(rmacnak): Use a real scanner. |
554 var pattern = new RegExp("library ${script.library.name}"); | 514 var pattern = new RegExp("library ${script.library.name}"); |
555 var match = pattern.firstMatch(line.text); | 515 var match = pattern.firstMatch(line.text); |
556 if (match != null) { | 516 if (match != null) { |
557 var anno = new LibraryAnnotation(script.library); | 517 var anno = new LibraryAnnotation(script.library, |
| 518 inspectLink(script.library)); |
558 anno.line = line.line; | 519 anno.line = line.line; |
559 anno.columnStart = match.start + 8; | 520 anno.columnStart = match.start + 8; |
560 anno.columnStop = match.end; | 521 anno.columnStop = match.end; |
561 annotations.add(anno); | 522 annotations.add(anno); |
562 } | 523 } |
563 // TODO(rmacnak): Use a real scanner. | 524 // TODO(rmacnak): Use a real scanner. |
564 pattern = new RegExp("part of ${script.library.name}"); | 525 pattern = new RegExp("part of ${script.library.name}"); |
565 match = pattern.firstMatch(line.text); | 526 match = pattern.firstMatch(line.text); |
566 if (match != null) { | 527 if (match != null) { |
567 var anno = new LibraryAnnotation(script.library); | 528 var anno = new LibraryAnnotation(script.library, |
| 529 inspectLink(script.library)); |
568 anno.line = line.line; | 530 anno.line = line.line; |
569 anno.columnStart = match.start + 8; | 531 anno.columnStart = match.start + 8; |
570 anno.columnStop = match.end; | 532 anno.columnStop = match.end; |
571 annotations.add(anno); | 533 annotations.add(anno); |
572 } | 534 } |
573 } | 535 } |
574 } | 536 } |
575 | 537 |
576 Library resolveDependency(String relativeUri) { | 538 Library resolveDependency(String relativeUri) { |
577 var targetUri = Uri.parse(script.library.uri).resolve(relativeUri); | 539 var targetUri = Uri.parse(script.library.uri).resolve(relativeUri); |
(...skipping 13 matching lines...) Expand all Loading... |
591 new RegExp('import "(.*)"'), | 553 new RegExp('import "(.*)"'), |
592 new RegExp("export '(.*)'"), | 554 new RegExp("export '(.*)'"), |
593 new RegExp('export "(.*)"'), | 555 new RegExp('export "(.*)"'), |
594 ]; | 556 ]; |
595 for (ScriptLine line in script.lines) { | 557 for (ScriptLine line in script.lines) { |
596 for (var pattern in patterns) { | 558 for (var pattern in patterns) { |
597 var match = pattern.firstMatch(line.text); | 559 var match = pattern.firstMatch(line.text); |
598 if (match != null) { | 560 if (match != null) { |
599 Library target = resolveDependency(match[1]); | 561 Library target = resolveDependency(match[1]); |
600 if (target != null) { | 562 if (target != null) { |
601 var anno = new LibraryAnnotation(target); | 563 var anno = new LibraryAnnotation(target, inspectLink(target)); |
602 anno.line = line.line; | 564 anno.line = line.line; |
603 anno.columnStart = match.start + 8; | 565 anno.columnStart = match.start + 8; |
604 anno.columnStop = match.end - 1; | 566 anno.columnStop = match.end - 1; |
605 annotations.add(anno); | 567 annotations.add(anno); |
606 } | 568 } |
607 } | 569 } |
608 } | 570 } |
609 } | 571 } |
610 } | 572 } |
611 | 573 |
(...skipping 18 matching lines...) Expand all Loading... |
630 var patterns = [ | 592 var patterns = [ |
631 new RegExp("part '(.*)'"), | 593 new RegExp("part '(.*)'"), |
632 new RegExp('part "(.*)"'), | 594 new RegExp('part "(.*)"'), |
633 ]; | 595 ]; |
634 for (ScriptLine line in script.lines) { | 596 for (ScriptLine line in script.lines) { |
635 for (var pattern in patterns) { | 597 for (var pattern in patterns) { |
636 var match = pattern.firstMatch(line.text); | 598 var match = pattern.firstMatch(line.text); |
637 if (match != null) { | 599 if (match != null) { |
638 Script part = resolvePart(match[1]); | 600 Script part = resolvePart(match[1]); |
639 if (part != null) { | 601 if (part != null) { |
640 var anno = new PartAnnotation(part); | 602 var anno = new PartAnnotation(part, inspectLink(part)); |
641 anno.line = line.line; | 603 anno.line = line.line; |
642 anno.columnStart = match.start + 6; | 604 anno.columnStart = match.start + 6; |
643 anno.columnStop = match.end - 1; | 605 anno.columnStop = match.end - 1; |
644 annotations.add(anno); | 606 annotations.add(anno); |
645 } | 607 } |
646 } | 608 } |
647 } | 609 } |
648 } | 610 } |
649 } | 611 } |
650 | 612 |
651 void addClassAnnotations() { | 613 void addClassAnnotations() { |
652 for (var cls in script.library.classes) { | 614 for (var cls in script.library.classes) { |
653 if ((cls.location != null) && (cls.location.script == script)) { | 615 if ((cls.location != null) && (cls.location.script == script)) { |
654 annotations.add(new ClassDeclarationAnnotation(cls)); | 616 var a = new ClassDeclarationAnnotation(cls, inspectLink(cls)); |
| 617 annotations.add(a); |
655 } | 618 } |
656 } | 619 } |
657 } | 620 } |
658 | 621 |
659 void addFieldAnnotations() { | 622 void addFieldAnnotations() { |
660 for (var field in script.library.variables) { | 623 for (var field in script.library.variables) { |
661 if ((field.location != null) && (field.location.script == script)) { | 624 if ((field.location != null) && (field.location.script == script)) { |
662 annotations.add(new FieldDeclarationAnnotation(field)); | 625 var a = new FieldDeclarationAnnotation(field, inspectLink(field)); |
| 626 annotations.add(a); |
663 } | 627 } |
664 } | 628 } |
665 for (var cls in script.library.classes) { | 629 for (var cls in script.library.classes) { |
666 for (var field in cls.fields) { | 630 for (var field in cls.fields) { |
667 if ((field.location != null) && (field.location.script == script)) { | 631 if ((field.location != null) && (field.location.script == script)) { |
668 annotations.add(new FieldDeclarationAnnotation(field)); | 632 var a = new FieldDeclarationAnnotation(field, inspectLink(field)); |
| 633 annotations.add(a); |
669 } | 634 } |
670 } | 635 } |
671 } | 636 } |
672 } | 637 } |
673 | 638 |
674 void addFunctionAnnotations() { | 639 void addFunctionAnnotations() { |
675 for (var func in script.library.functions) { | 640 for (var func in script.library.functions) { |
676 if ((func.location != null) && | 641 if ((func.location != null) && |
677 (func.location.script == script) && | 642 (func.location.script == script) && |
678 (func.kind != FunctionKind.kImplicitGetterFunction) && | 643 (func.kind != FunctionKind.kImplicitGetterFunction) && |
679 (func.kind != FunctionKind.kImplicitSetterFunction)) { | 644 (func.kind != FunctionKind.kImplicitSetterFunction)) { |
680 // We annotate a field declaration with the field instead of the | 645 // We annotate a field declaration with the field instead of the |
681 // implicit getter or setter. | 646 // implicit getter or setter. |
682 annotations.add(new FunctionDeclarationAnnotation(func)); | 647 var a = new FunctionDeclarationAnnotation(func, inspectLink(func)); |
| 648 annotations.add(a); |
683 } | 649 } |
684 } | 650 } |
685 for (var cls in script.library.classes) { | 651 for (var cls in script.library.classes) { |
686 for (var func in cls.functions) { | 652 for (var func in cls.functions) { |
687 if ((func.location != null) && | 653 if ((func.location != null) && |
688 (func.location.script == script) && | 654 (func.location.script == script) && |
689 (func.kind != FunctionKind.kImplicitGetterFunction) && | 655 (func.kind != FunctionKind.kImplicitGetterFunction) && |
690 (func.kind != FunctionKind.kImplicitSetterFunction)) { | 656 (func.kind != FunctionKind.kImplicitSetterFunction)) { |
691 // We annotate a field declaration with the field instead of the | 657 // We annotate a field declaration with the field instead of the |
692 // implicit getter or setter. | 658 // implicit getter or setter. |
693 annotations.add(new FunctionDeclarationAnnotation(func)); | 659 var a = new FunctionDeclarationAnnotation(func, inspectLink(func)); |
| 660 annotations.add(a); |
694 } | 661 } |
695 } | 662 } |
696 } | 663 } |
697 } | 664 } |
698 | 665 |
699 void addCallSiteAnnotations() { | 666 void addCallSiteAnnotations() { |
700 for (var callSite in script.callSites) { | 667 for (var callSite in script.callSites) { |
701 annotations.add(new CallSiteAnnotation(callSite)); | 668 annotations.add(new CallSiteAnnotation(callSite)); |
702 } | 669 } |
703 } | 670 } |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 class SourceInsetElement extends PolymerElement { | 894 class SourceInsetElement extends PolymerElement { |
928 SourceInsetElement.created() : super.created(); | 895 SourceInsetElement.created() : super.created(); |
929 | 896 |
930 @published SourceLocation location; | 897 @published SourceLocation location; |
931 @published String height = null; | 898 @published String height = null; |
932 @published int currentPos; | 899 @published int currentPos; |
933 @published bool inDebuggerContext = false; | 900 @published bool inDebuggerContext = false; |
934 @published ObservableList variables; | 901 @published ObservableList variables; |
935 } | 902 } |
936 | 903 |
OLD | NEW |