| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
package com.google.javascript.rhino; |
| 41 |
|
| 42 |
import com.google.javascript.rhino.JSDocInfo.Visibility; |
| 43 |
import com.google.javascript.rhino.jstype.StaticSourceFile; |
| 44 |
|
| 45 |
import java.util.List; |
| 46 |
import java.util.Set; |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
final public class JSDocInfoBuilder { |
| 57 |
|
| 58 |
private JSDocInfo currentInfo; |
| 59 |
|
| 60 |
|
| 61 |
private boolean populated = false; |
| 62 |
|
| 63 |
|
| 64 |
private boolean parseDocumentation = false; |
| 65 |
|
| 66 |
|
| 67 |
private JSDocInfo.Marker currentMarker = null; |
| 68 |
|
| 69 |
public JSDocInfoBuilder(boolean parseDocumentation) { |
| 70 |
this.currentInfo = new JSDocInfo(parseDocumentation); |
| 71 |
this.parseDocumentation = parseDocumentation; |
| 72 |
} |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
public void recordOriginalCommentString(String sourceComment) { |
| 79 |
if (parseDocumentation) { |
| 80 |
currentInfo.setOriginalCommentString(sourceComment); |
| 81 |
} |
| 82 |
} |
| 83 |
|
| 84 |
public boolean shouldParseDocumentation() { |
| 85 |
return parseDocumentation; |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
public boolean isPopulated() { |
| 93 |
return populated; |
| 94 |
} |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
public boolean isPopulatedWithFileOverview() { |
| 102 |
return isPopulated() && |
| 103 |
(currentInfo.hasFileOverview() || currentInfo.isExterns() || |
| 104 |
currentInfo.isNoCompile()); |
| 105 |
} |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
public boolean isDescriptionRecorded() { |
| 111 |
return currentInfo.getDescription() != null; |
| 112 |
} |
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
public JSDocInfo build(Node associatedNode) { |
| 125 |
if (populated) { |
| 126 |
JSDocInfo built = currentInfo; |
| 127 |
built.setAssociatedNode(associatedNode); |
| 128 |
populateDefaults(built); |
| 129 |
populated = false; |
| 130 |
currentInfo = new JSDocInfo(this.parseDocumentation); |
| 131 |
return built; |
| 132 |
} else { |
| 133 |
return null; |
| 134 |
} |
| 135 |
} |
| 136 |
|
| 137 |
|
| 138 |
private static void populateDefaults(JSDocInfo info) { |
| 139 |
if (info.getVisibility() == null) { |
| 140 |
info.setVisibility(Visibility.INHERITED); |
| 141 |
} |
| 142 |
} |
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
public void markAnnotation(String annotation, int lineno, int charno) { |
| 149 |
JSDocInfo.Marker marker = currentInfo.addMarker(); |
| 150 |
|
| 151 |
if (marker != null) { |
| 152 |
JSDocInfo.TrimmedStringPosition position = |
| 153 |
new JSDocInfo.TrimmedStringPosition(); |
| 154 |
position.setItem(annotation); |
| 155 |
position.setPositionInformation(lineno, charno, lineno, |
| 156 |
charno + annotation.length()); |
| 157 |
marker.setAnnotation(position); |
| 158 |
populated = true; |
| 159 |
} |
| 160 |
|
| 161 |
currentMarker = marker; |
| 162 |
} |
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
public void markText(String text, int startLineno, int startCharno, |
| 168 |
int endLineno, int endCharno) { |
| 169 |
if (currentMarker != null) { |
| 170 |
JSDocInfo.StringPosition position = new JSDocInfo.StringPosition(); |
| 171 |
position.setItem(text); |
| 172 |
position.setPositionInformation(startLineno, startCharno, |
| 173 |
endLineno, endCharno); |
| 174 |
currentMarker.setDescription(position); |
| 175 |
} |
| 176 |
} |
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
public void markTypeNode(Node typeNode, int lineno, int startCharno, |
| 182 |
int endLineno, int endCharno, boolean hasLC) { |
| 183 |
if (currentMarker != null) { |
| 184 |
JSDocInfo.TypePosition position = new JSDocInfo.TypePosition(); |
| 185 |
position.setItem(typeNode); |
| 186 |
position.setHasBrackets(hasLC); |
| 187 |
position.setPositionInformation(lineno, startCharno, |
| 188 |
endLineno, endCharno); |
| 189 |
currentMarker.setType(position); |
| 190 |
} |
| 191 |
} |
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
@Deprecated |
| 198 |
public void markName(String name, int lineno, int charno) { |
| 199 |
markName(name, null, lineno, charno); |
| 200 |
} |
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
public void markName(String name, StaticSourceFile file, |
| 206 |
int lineno, int charno) { |
| 207 |
if (currentMarker != null) { |
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
JSDocInfo.TrimmedStringPosition position = |
| 216 |
new JSDocInfo.TrimmedStringPosition(); |
| 217 |
position.setItem(name); |
| 218 |
position.setPositionInformation(lineno, charno, |
| 219 |
lineno, charno + name.length()); |
| 220 |
currentMarker.setName(position); |
| 221 |
|
| 222 |
SourcePosition<Node> nodePos = |
| 223 |
new JSDocInfo.NamePosition(); |
| 224 |
Node node = Node.newString(Token.NAME, name, lineno, charno); |
| 225 |
node.setLength(name.length()); |
| 226 |
node.setStaticSourceFile(file); |
| 227 |
nodePos.setItem(node); |
| 228 |
nodePos.setPositionInformation(lineno, charno, |
| 229 |
lineno, charno + name.length()); |
| 230 |
currentMarker.setNameNode(nodePos); |
| 231 |
} |
| 232 |
} |
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
public boolean recordBlockDescription(String description) { |
| 240 |
populated = true; |
| 241 |
return currentInfo.documentBlock(description); |
| 242 |
} |
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
public boolean recordVisibility(Visibility visibility) { |
| 251 |
if (currentInfo.getVisibility() == null) { |
| 252 |
populated = true; |
| 253 |
currentInfo.setVisibility(visibility); |
| 254 |
return true; |
| 255 |
} else { |
| 256 |
return false; |
| 257 |
} |
| 258 |
} |
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
public boolean recordParameter(String parameterName, JSTypeExpression type) { |
| 267 |
if (!hasAnySingletonTypeTags() && |
| 268 |
currentInfo.declareParam(type, parameterName)) { |
| 269 |
populated = true; |
| 270 |
return true; |
| 271 |
} else { |
| 272 |
return false; |
| 273 |
} |
| 274 |
} |
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
public boolean recordParameterDescription( |
| 283 |
String parameterName, String description) { |
| 284 |
if (currentInfo.documentParam(parameterName, description)) { |
| 285 |
populated = true; |
| 286 |
return true; |
| 287 |
} else { |
| 288 |
return false; |
| 289 |
} |
| 290 |
} |
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
public boolean recordTemplateTypeNames(List<String> names) { |
| 299 |
if (currentInfo.declareTemplateTypeNames(names)) { |
| 300 |
populated = true; |
| 301 |
return true; |
| 302 |
} else { |
| 303 |
return false; |
| 304 |
} |
| 305 |
} |
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
public boolean recordClassTemplateTypeNames(List<String> names) { |
| 314 |
if (currentInfo.declareClassTemplateTypeNames(names)) { |
| 315 |
populated = true; |
| 316 |
return true; |
| 317 |
} else { |
| 318 |
return false; |
| 319 |
} |
| 320 |
} |
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
public boolean recordThrowType(JSTypeExpression type) { |
| 327 |
if (!hasAnySingletonTypeTags()) { |
| 328 |
currentInfo.declareThrows(type); |
| 329 |
populated = true; |
| 330 |
return true; |
| 331 |
} |
| 332 |
return false; |
| 333 |
} |
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
public boolean recordThrowDescription( |
| 342 |
JSTypeExpression type, String description) { |
| 343 |
if (currentInfo.documentThrows(type, description)) { |
| 344 |
populated = true; |
| 345 |
return true; |
| 346 |
} else { |
| 347 |
return false; |
| 348 |
} |
| 349 |
} |
| 350 |
|
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
public boolean addAuthor(String author) { |
| 356 |
if (currentInfo.documentAuthor(author)) { |
| 357 |
populated = true; |
| 358 |
return true; |
| 359 |
} else { |
| 360 |
return false; |
| 361 |
} |
| 362 |
} |
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
public boolean addReference(String reference) { |
| 369 |
if (currentInfo.documentReference(reference)) { |
| 370 |
populated = true; |
| 371 |
return true; |
| 372 |
} else { |
| 373 |
return false; |
| 374 |
} |
| 375 |
} |
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
public boolean recordConsistentIdGenerator() { |
| 386 |
if (!currentInfo.isConsistentIdGenerator()) { |
| 387 |
currentInfo.setConsistentIdGenerator(true); |
| 388 |
populated = true; |
| 389 |
return true; |
| 390 |
} else { |
| 391 |
return false; |
| 392 |
} |
| 393 |
} |
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
public boolean recordStableIdGenerator() { |
| 403 |
if (!currentInfo.isStableIdGenerator()) { |
| 404 |
currentInfo.setStableIdGenerator(true); |
| 405 |
populated = true; |
| 406 |
return true; |
| 407 |
} else { |
| 408 |
return false; |
| 409 |
} |
| 410 |
} |
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
public boolean recordVersion(String version) { |
| 416 |
if (currentInfo.documentVersion(version)) { |
| 417 |
populated = true; |
| 418 |
return true; |
| 419 |
} else { |
| 420 |
return false; |
| 421 |
} |
| 422 |
} |
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
|
| 427 |
public boolean recordDeprecationReason(String reason) { |
| 428 |
if (currentInfo.setDeprecationReason(reason)) { |
| 429 |
populated = true; |
| 430 |
return true; |
| 431 |
} else { |
| 432 |
return false; |
| 433 |
} |
| 434 |
} |
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
public boolean recordSuppressions(Set<String> suppressions) { |
| 440 |
if (currentInfo.setSuppressions(suppressions)) { |
| 441 |
populated = true; |
| 442 |
return true; |
| 443 |
} else { |
| 444 |
return false; |
| 445 |
} |
| 446 |
} |
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
|
| 451 |
public boolean recordModifies(Set<String> modifies) { |
| 452 |
if (!hasAnySingletonSideEffectTags() |
| 453 |
&& currentInfo.setModifies(modifies)) { |
| 454 |
populated = true; |
| 455 |
return true; |
| 456 |
} else { |
| 457 |
return false; |
| 458 |
} |
| 459 |
} |
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
public boolean recordType(JSTypeExpression type) { |
| 468 |
if (type != null && !hasAnyTypeRelatedTags()) { |
| 469 |
currentInfo.setType(type); |
| 470 |
populated = true; |
| 471 |
return true; |
| 472 |
} else { |
| 473 |
return false; |
| 474 |
} |
| 475 |
} |
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
public boolean recordTypedef(JSTypeExpression type) { |
| 482 |
if (type != null && !hasAnyTypeRelatedTags()) { |
| 483 |
currentInfo.setTypedefType(type); |
| 484 |
populated = true; |
| 485 |
return true; |
| 486 |
} |
| 487 |
return false; |
| 488 |
} |
| 489 |
|
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
public boolean recordIdGenerator() { |
| 499 |
if (!currentInfo.isIdGenerator()) { |
| 500 |
currentInfo.setIdGenerator(true); |
| 501 |
populated = true; |
| 502 |
return true; |
| 503 |
} else { |
| 504 |
return false; |
| 505 |
} |
| 506 |
} |
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
public boolean recordReturnType(JSTypeExpression jsType) { |
| 515 |
if (jsType != null && currentInfo.getReturnType() == null && |
| 516 |
!hasAnySingletonTypeTags()) { |
| 517 |
currentInfo.setReturnType(jsType); |
| 518 |
populated = true; |
| 519 |
return true; |
| 520 |
} else { |
| 521 |
return false; |
| 522 |
} |
| 523 |
} |
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
public boolean recordReturnDescription(String description) { |
| 532 |
if (currentInfo.documentReturn(description)) { |
| 533 |
populated = true; |
| 534 |
return true; |
| 535 |
} else { |
| 536 |
return false; |
| 537 |
} |
| 538 |
} |
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
public boolean recordDefineType(JSTypeExpression type) { |
| 548 |
if (type != null && |
| 549 |
!currentInfo.isConstant() && |
| 550 |
!currentInfo.isDefine() && |
| 551 |
recordType(type)) { |
| 552 |
currentInfo.setDefine(true); |
| 553 |
populated = true; |
| 554 |
return true; |
| 555 |
} else { |
| 556 |
return false; |
| 557 |
} |
| 558 |
} |
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
public boolean recordEnumParameterType(JSTypeExpression type) { |
| 567 |
if (type != null && !hasAnyTypeRelatedTags()) { |
| 568 |
currentInfo.setEnumParameterType(type); |
| 569 |
populated = true; |
| 570 |
return true; |
| 571 |
} else { |
| 572 |
return false; |
| 573 |
} |
| 574 |
} |
| 575 |
|
| 576 |
|
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
|
| 583 |
public boolean recordThisType(JSTypeExpression type) { |
| 584 |
if (type != null && !hasAnySingletonTypeTags() && |
| 585 |
!currentInfo.hasThisType()) { |
| 586 |
currentInfo.setThisType(type); |
| 587 |
populated = true; |
| 588 |
return true; |
| 589 |
} else { |
| 590 |
return false; |
| 591 |
} |
| 592 |
} |
| 593 |
|
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
public boolean recordBaseType(JSTypeExpression jsType) { |
| 601 |
if (jsType != null && !hasAnySingletonTypeTags() && |
| 602 |
!currentInfo.hasBaseType()) { |
| 603 |
currentInfo.setBaseType(jsType); |
| 604 |
populated = true; |
| 605 |
return true; |
| 606 |
} else { |
| 607 |
return false; |
| 608 |
} |
| 609 |
} |
| 610 |
|
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
public boolean recordConstancy() { |
| 619 |
if (!currentInfo.isConstant()) { |
| 620 |
currentInfo.setConstant(true); |
| 621 |
populated = true; |
| 622 |
return true; |
| 623 |
} else { |
| 624 |
return false; |
| 625 |
} |
| 626 |
} |
| 627 |
|
| 628 |
|
| 629 |
|
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
|
| 634 |
public boolean recordDescription(String description) { |
| 635 |
if (description != null && currentInfo.getDescription() == null) { |
| 636 |
currentInfo.setDescription(description); |
| 637 |
populated = true; |
| 638 |
return true; |
| 639 |
} else { |
| 640 |
return false; |
| 641 |
} |
| 642 |
} |
| 643 |
|
| 644 |
|
| 645 |
|
| 646 |
|
| 647 |
|
| 648 |
|
| 649 |
|
| 650 |
public boolean recordMeaning(String meaning) { |
| 651 |
if (meaning != null && currentInfo.getMeaning() == null) { |
| 652 |
currentInfo.setMeaning(meaning); |
| 653 |
populated = true; |
| 654 |
return true; |
| 655 |
} else { |
| 656 |
return false; |
| 657 |
} |
| 658 |
} |
| 659 |
|
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
public boolean recordFileOverview(String description) { |
| 667 |
if (currentInfo.documentFileOverview(description)) { |
| 668 |
populated = true; |
| 669 |
return true; |
| 670 |
} else { |
| 671 |
return false; |
| 672 |
} |
| 673 |
} |
| 674 |
|
| 675 |
|
| 676 |
|
| 677 |
|
| 678 |
|
| 679 |
|
| 680 |
|
| 681 |
|
| 682 |
public boolean recordHiddenness() { |
| 683 |
if (!currentInfo.isHidden()) { |
| 684 |
currentInfo.setHidden(true); |
| 685 |
populated = true; |
| 686 |
return true; |
| 687 |
} else { |
| 688 |
return false; |
| 689 |
} |
| 690 |
} |
| 691 |
|
| 692 |
|
| 693 |
|
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
|
| 698 |
|
| 699 |
public boolean recordNoCompile() { |
| 700 |
if (!currentInfo.isNoCompile()) { |
| 701 |
currentInfo.setNoCompile(true); |
| 702 |
populated = true; |
| 703 |
return true; |
| 704 |
} else { |
| 705 |
return false; |
| 706 |
} |
| 707 |
} |
| 708 |
|
| 709 |
|
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
|
| 715 |
|
| 716 |
public boolean recordNoTypeCheck() { |
| 717 |
if (!currentInfo.isNoTypeCheck()) { |
| 718 |
currentInfo.setNoCheck(true); |
| 719 |
populated = true; |
| 720 |
return true; |
| 721 |
} else { |
| 722 |
return false; |
| 723 |
} |
| 724 |
} |
| 725 |
|
| 726 |
|
| 727 |
|
| 728 |
|
| 729 |
|
| 730 |
|
| 731 |
|
| 732 |
|
| 733 |
|
| 734 |
public boolean recordConstructor() { |
| 735 |
if (!hasAnySingletonTypeTags() && |
| 736 |
!currentInfo.isConstructor() && !currentInfo.isInterface()) { |
| 737 |
currentInfo.setConstructor(true); |
| 738 |
populated = true; |
| 739 |
return true; |
| 740 |
} else { |
| 741 |
return false; |
| 742 |
} |
| 743 |
} |
| 744 |
|
| 745 |
|
| 746 |
|
| 747 |
|
| 748 |
|
| 749 |
public boolean isConstructorRecorded() { |
| 750 |
return currentInfo.isConstructor(); |
| 751 |
} |
| 752 |
|
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
|
| 757 |
|
| 758 |
|
| 759 |
|
| 760 |
public boolean recordStruct() { |
| 761 |
if (hasAnySingletonTypeTags() || currentInfo.isInterface() || |
| 762 |
currentInfo.makesDicts() || currentInfo.makesStructs()) { |
| 763 |
return false; |
| 764 |
} |
| 765 |
currentInfo.setStruct(); |
| 766 |
populated = true; |
| 767 |
return true; |
| 768 |
} |
| 769 |
|
| 770 |
|
| 771 |
|
| 772 |
|
| 773 |
|
| 774 |
|
| 775 |
|
| 776 |
|
| 777 |
public boolean recordDict() { |
| 778 |
if (hasAnySingletonTypeTags() || currentInfo.isInterface() || |
| 779 |
currentInfo.makesDicts() || currentInfo.makesStructs()) { |
| 780 |
return false; |
| 781 |
} |
| 782 |
currentInfo.setDict(); |
| 783 |
populated = true; |
| 784 |
return true; |
| 785 |
} |
| 786 |
|
| 787 |
|
| 788 |
|
| 789 |
|
| 790 |
|
| 791 |
|
| 792 |
|
| 793 |
|
| 794 |
|
| 795 |
public boolean recordJavaDispatch() { |
| 796 |
if (!currentInfo.isJavaDispatch()) { |
| 797 |
currentInfo.setJavaDispatch(true); |
| 798 |
populated = true; |
| 799 |
return true; |
| 800 |
} else { |
| 801 |
return false; |
| 802 |
} |
| 803 |
} |
| 804 |
|
| 805 |
|
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
public boolean isJavaDispatch() { |
| 810 |
return currentInfo.isJavaDispatch(); |
| 811 |
} |
| 812 |
|
| 813 |
|
| 814 |
|
| 815 |
|
| 816 |
|
| 817 |
public boolean recordPreserveTry() { |
| 818 |
if (!currentInfo.shouldPreserveTry()) { |
| 819 |
currentInfo.setShouldPreserveTry(true); |
| 820 |
populated = true; |
| 821 |
return true; |
| 822 |
} else { |
| 823 |
return false; |
| 824 |
} |
| 825 |
} |
| 826 |
|
| 827 |
|
| 828 |
|
| 829 |
|
| 830 |
|
| 831 |
public boolean recordOverride() { |
| 832 |
if (!currentInfo.isOverride()) { |
| 833 |
currentInfo.setOverride(true); |
| 834 |
populated = true; |
| 835 |
return true; |
| 836 |
} else { |
| 837 |
return false; |
| 838 |
} |
| 839 |
} |
| 840 |
|
| 841 |
|
| 842 |
|
| 843 |
|
| 844 |
|
| 845 |
public boolean recordNoAlias() { |
| 846 |
if (!currentInfo.isNoAlias()) { |
| 847 |
currentInfo.setNoAlias(true); |
| 848 |
populated = true; |
| 849 |
return true; |
| 850 |
} else { |
| 851 |
return false; |
| 852 |
} |
| 853 |
} |
| 854 |
|
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
public boolean recordDeprecated() { |
| 860 |
if (!currentInfo.isDeprecated()) { |
| 861 |
currentInfo.setDeprecated(true); |
| 862 |
populated = true; |
| 863 |
return true; |
| 864 |
} else { |
| 865 |
return false; |
| 866 |
} |
| 867 |
} |
| 868 |
|
| 869 |
|
| 870 |
|
| 871 |
|
| 872 |
|
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
public boolean recordInterface() { |
| 877 |
if (hasAnySingletonTypeTags() || |
| 878 |
currentInfo.makesStructs() || currentInfo.makesDicts() || |
| 879 |
currentInfo.isConstructor() || currentInfo.isInterface()) { |
| 880 |
return false; |
| 881 |
} |
| 882 |
currentInfo.setInterface(true); |
| 883 |
populated = true; |
| 884 |
return true; |
| 885 |
} |
| 886 |
|
| 887 |
|
| 888 |
|
| 889 |
|
| 890 |
|
| 891 |
public boolean recordExport() { |
| 892 |
if (!currentInfo.isExport()) { |
| 893 |
currentInfo.setExport(true); |
| 894 |
populated = true; |
| 895 |
return true; |
| 896 |
} else { |
| 897 |
return false; |
| 898 |
} |
| 899 |
} |
| 900 |
|
| 901 |
|
| 902 |
|
| 903 |
|
| 904 |
|
| 905 |
public boolean recordExpose() { |
| 906 |
if (!currentInfo.isExpose()) { |
| 907 |
currentInfo.setExpose(true); |
| 908 |
populated = true; |
| 909 |
return true; |
| 910 |
} else { |
| 911 |
return false; |
| 912 |
} |
| 913 |
} |
| 914 |
|
| 915 |
|
| 916 |
|
| 917 |
|
| 918 |
|
| 919 |
public boolean recordNoShadow() { |
| 920 |
if (!currentInfo.isNoShadow()) { |
| 921 |
currentInfo.setNoShadow(true); |
| 922 |
populated = true; |
| 923 |
return true; |
| 924 |
} else { |
| 925 |
return false; |
| 926 |
} |
| 927 |
} |
| 928 |
|
| 929 |
|
| 930 |
|
| 931 |
|
| 932 |
|
| 933 |
public boolean recordImplicitCast() { |
| 934 |
if (!currentInfo.isImplicitCast()) { |
| 935 |
currentInfo.setImplicitCast(true); |
| 936 |
populated = true; |
| 937 |
return true; |
| 938 |
} else { |
| 939 |
return false; |
| 940 |
} |
| 941 |
} |
| 942 |
|
| 943 |
|
| 944 |
|
| 945 |
|
| 946 |
|
| 947 |
public boolean recordNoSideEffects() { |
| 948 |
if (!hasAnySingletonSideEffectTags() |
| 949 |
&& !currentInfo.isNoSideEffects()) { |
| 950 |
currentInfo.setNoSideEffects(true); |
| 951 |
populated = true; |
| 952 |
return true; |
| 953 |
} else { |
| 954 |
return false; |
| 955 |
} |
| 956 |
} |
| 957 |
|
| 958 |
|
| 959 |
|
| 960 |
|
| 961 |
|
| 962 |
public boolean recordExterns() { |
| 963 |
if (!currentInfo.isExterns()) { |
| 964 |
currentInfo.setExterns(true); |
| 965 |
populated = true; |
| 966 |
return true; |
| 967 |
} else { |
| 968 |
return false; |
| 969 |
} |
| 970 |
} |
| 971 |
|
| 972 |
|
| 973 |
|
| 974 |
|
| 975 |
|
| 976 |
public boolean isInterfaceRecorded() { |
| 977 |
return currentInfo.isInterface(); |
| 978 |
} |
| 979 |
|
| 980 |
|
| 981 |
|
| 982 |
|
| 983 |
public boolean hasParameter(String name) { |
| 984 |
return currentInfo.hasParameter(name); |
| 985 |
} |
| 986 |
|
| 987 |
|
| 988 |
|
| 989 |
|
| 990 |
public boolean recordImplementedInterface(JSTypeExpression interfaceName) { |
| 991 |
if (currentInfo.addImplementedInterface(interfaceName)) { |
| 992 |
populated = true; |
| 993 |
return true; |
| 994 |
} else { |
| 995 |
return false; |
| 996 |
} |
| 997 |
} |
| 998 |
|
| 999 |
|
| 1000 |
|
| 1001 |
|
| 1002 |
public boolean recordExtendedInterface(JSTypeExpression interfaceType) { |
| 1003 |
if (currentInfo.addExtendedInterface(interfaceType)) { |
| 1004 |
populated = true; |
| 1005 |
return true; |
| 1006 |
} else { |
| 1007 |
return false; |
| 1008 |
} |
| 1009 |
} |
| 1010 |
|
| 1011 |
|
| 1012 |
|
| 1013 |
|
| 1014 |
public boolean recordLends(String name) { |
| 1015 |
if (!hasAnyTypeRelatedTags()) { |
| 1016 |
currentInfo.setLendsName(name); |
| 1017 |
populated = true; |
| 1018 |
return true; |
| 1019 |
} else { |
| 1020 |
return false; |
| 1021 |
} |
| 1022 |
} |
| 1023 |
|
| 1024 |
|
| 1025 |
|
| 1026 |
|
| 1027 |
public boolean isNgInjectRecorded() { |
| 1028 |
return currentInfo.isNgInject(); |
| 1029 |
} |
| 1030 |
|
| 1031 |
|
| 1032 |
|
| 1033 |
|
| 1034 |
|
| 1035 |
public boolean recordNgInject(boolean ngInject) { |
| 1036 |
if (!isNgInjectRecorded()) { |
| 1037 |
currentInfo.setNgInject(ngInject); |
| 1038 |
populated = true; |
| 1039 |
return true; |
| 1040 |
} else { |
| 1041 |
return false; |
| 1042 |
} |
| 1043 |
} |
| 1044 |
|
| 1045 |
|
| 1046 |
|
| 1047 |
|
| 1048 |
|
| 1049 |
private boolean hasAnyTypeRelatedTags() { |
| 1050 |
return currentInfo.isConstructor() || |
| 1051 |
currentInfo.isInterface() || |
| 1052 |
currentInfo.getParameterCount() > 0 || |
| 1053 |
currentInfo.hasReturnType() || |
| 1054 |
currentInfo.hasBaseType() || |
| 1055 |
currentInfo.getExtendedInterfacesCount() > 0 || |
| 1056 |
currentInfo.getLendsName() != null || |
| 1057 |
currentInfo.hasThisType() || |
| 1058 |
hasAnySingletonTypeTags(); |
| 1059 |
} |
| 1060 |
|
| 1061 |
|
| 1062 |
|
| 1063 |
|
| 1064 |
|
| 1065 |
|
| 1066 |
private boolean hasAnySingletonTypeTags() { |
| 1067 |
return currentInfo.hasType() || |
| 1068 |
currentInfo.hasTypedefType() || |
| 1069 |
currentInfo.hasEnumParameterType(); |
| 1070 |
} |
| 1071 |
|
| 1072 |
|
| 1073 |
|
| 1074 |
|
| 1075 |
|
| 1076 |
|
| 1077 |
private boolean hasAnySingletonSideEffectTags() { |
| 1078 |
return currentInfo.isNoSideEffects() || |
| 1079 |
currentInfo.hasModifies(); |
| 1080 |
} |
| 1081 |
|
| 1082 |
} |