Debian Codegraph @

src/com/google/javascript/jscomp/CallGraph.java

raw symbols SCIP
1 /*
2 * Copyright 2010 The Closure Compiler Authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package com.google.javascript.jscomp;
17
18 import com.google.common.annotations.VisibleForTesting;
19 import com.google.common.base.Preconditions;
20 import com.google.common.base.Predicate;
21 import com.google.common.collect.Collections2;
22 import com.google.common.collect.ImmutableList;
23 import com.google.common.collect.Maps;
24 import com.google.javascript.jscomp.DefinitionsRemover.Definition;
25 import com.google.javascript.jscomp.NameReferenceGraph.Name;
26 import com.google.javascript.jscomp.NodeTraversal.AbstractPostOrderCallback;
27 import com.google.javascript.jscomp.graph.DiGraph;
28 import com.google.javascript.jscomp.graph.LinkedDirectedGraph;
29 import com.google.javascript.rhino.Node;
30 import com.google.javascript.rhino.Token;
31
32 import java.util.Collection;
33 import java.util.LinkedList;
34 import java.util.Map;
35
36 /**
37 * A pass the uses a {@link DefinitionProvider} to compute a call graph for an
38 * AST.
39 *
40 * <p>A {@link CallGraph} connects {@link Function}s to {@link Callsite}s and
41 * vice versa: each function in the graph links to the callsites it contains and
42 * each callsite links to the functions it could call. Similarly, each callsite
43 * links to the function that contains it and each function links to the
44 * callsites that could call it.
45 *
46 * <p>The callgraph is not precise. That is, a callsite may indicate it can
47 * call a function when in fact it does not do so in the running program.
48 *
49 * <p>The callgraph is also not complete: in some cases it may be unable to
50 * determine some targets of a callsite. In this case,
51 * Callsite.hasUnknownTarget() will return true.
52 *
53 * <p>The CallGraph doesn't (currently) have functions for externally defined
54 * functions; however, callsites that target externs will have hasExternTarget()
55 * return true.
56 *
57 * <p>TODO(dcc): Have CallGraph (optionally?) include functions for externs.
58 *
59 * @author [email protected] (Devin Coughlin)
60 */
61 public class CallGraph implements CompilerPass {
62 private AbstractCompiler compiler;
63
64 /**
65 * Maps an AST node (with type Token.CALL or Token.NEW) to a Callsite object.
66 */
67 private Map<Node, Callsite> callsitesByNode;
68
69 /** Maps an AST node (with type Token.FUNCTION) to a Function object. */
70 private Map<Node, Function> functionsByNode;
71
72 /**
73 * Will the call graph support looking up the callsites that could call a
74 * given function?
75 */
76 private boolean computeBackwardGraph;
77
78 /**
79 * Will the call graph support looking up the functions that a given callsite
80 * can call?
81 */
82 private boolean computeForwardGraph;
83
84 /**
85 * If true, then the callgraph will use NameReferenceGraph as a
86 * definition provider; otherwise, use the faster SimpleDefinitionProvider.
87 */
88 private boolean useNameReferenceGraph = false;
89
90 /** Has the CallGraph already been constructed? */
91 private boolean alreadyRun = false;
92
93 /** The name we give the main function. */
94 @VisibleForTesting
95 public static final String MAIN_FUNCTION_NAME = "{main}";
96
97 /**
98 * Represents the global function. Calling getBody() on this
99 * function will yield the global script/block.
100 *
101 * TODO(dcc): having a single main function is somewhat misleading. Perhaps
102 * it might be better to make CallGraph module aware and have one per
103 * module?
104 */
105 private Function mainFunction;
106
107 /**
108 * Creates a call graph object supporting the specified lookups.
109 *
110 * At least one (and possibly both) of computeForwardGraph and
111 * computeBackwardGraph must be true.
112 *
113 * @param compiler The compiler
114 * @param computeForwardGraph Should the call graph allow lookup of the target
115 * functions a given callsite could call?
116 * @param computeBackwardGraph Should the call graph allow lookup of the
117 * callsites that could call a given function?
118 */
119 public CallGraph(AbstractCompiler compiler, boolean computeForwardGraph,
120 boolean computeBackwardGraph) {
121 Preconditions.checkArgument(computeForwardGraph || computeBackwardGraph);
122
123 this.compiler = compiler;
124
125 this.computeForwardGraph = computeForwardGraph;
126 this.computeBackwardGraph = computeBackwardGraph;
127
128 callsitesByNode = Maps.newLinkedHashMap();
129 functionsByNode = Maps.newLinkedHashMap();
130 }
131
132 /**
133 * Creates a call graph object support both forward and backward lookups.
134 */
135 public CallGraph(AbstractCompiler compiler) {
136 this(compiler, true, true);
137 }
138
139 /**
140 * Builds a call graph for the given externsRoot and jsRoot.
141 * This method must not be called more than once per CallGraph instance.
142 */
143 @Override
144 public void process(Node externsRoot, Node jsRoot) {
145 Preconditions.checkState(alreadyRun == false);
146
147 DefinitionProvider definitionProvider =
148 constructDefinitionProvider(externsRoot, jsRoot);
149
150 createFunctionsAndCallsites(jsRoot, definitionProvider);
151
152 fillInFunctionInformation(definitionProvider);
153
154 alreadyRun = true;
155 }
156
157 /**
158 * Returns the call graph Function object corresponding to the provided
159 * AST Token.FUNCTION node, or null if no such object exists.
160 */
161 public Function getFunctionForAstNode(Node functionNode) {
162 Preconditions.checkArgument(functionNode.isFunction());
163
164 return functionsByNode.get(functionNode);
165 }
166
167 /**
168 * Returns a Function object representing the "main" global function.
169 */
170 public Function getMainFunction() {
171 return mainFunction;
172 }
173
174 /**
175 * Returns a collection of all functions (including the main function)
176 * in the call graph.
177 */
178 public Collection<Function> getAllFunctions() {
179 return functionsByNode.values();
180 }
181
182 /**
183 * Finds a function with the given name. Throws an exception if
184 * there are no functions or multiple functions with the name. This is
185 * for testing purposes only.
186 */
187 @VisibleForTesting
188 public Function getUniqueFunctionWithName(final String desiredName) {
189 Collection<Function> functions =
190 Collections2.<Function>filter(getAllFunctions(),
191 new Predicate<Function>() {
192 @Override
193 public boolean apply(Function function) {
194
195 String functionName = function.getName();
196 // Anonymous functions will have null names,
197 // so it is important to handle that correctly here
198 if (functionName != null && desiredName != null) {
199 return desiredName.equals(functionName);
200 } else {
201 return desiredName == functionName;
202 }
203 }
204 });
205
206 if (functions.size() == 1) {
207 return functions.iterator().next();
208 } else {
209 throw new IllegalStateException("Found " + functions.size()
210 + " functions with name " + desiredName);
211 }
212 }
213
214 /**
215 * Returns the call graph Callsite object corresponding to the provided
216 * AST Token.CALL or Token.NEW node, or null if no such object exists.
217 */
218 public Callsite getCallsiteForAstNode(Node callsiteNode) {
219 Preconditions.checkArgument(callsiteNode.isCall() ||
220 callsiteNode.isNew());
221
222 return callsitesByNode.get(callsiteNode);
223 }
224
225 /**
226 * Returns a collection of all callsites in the call graph.
227 */
228 public Collection<Callsite> getAllCallsites() {
229 return callsitesByNode.values();
230 }
231
232 /**
233 * Creates {@link Function}s and {@link Callsite}s in a single
234 * AST traversal.
235 */
236 private void createFunctionsAndCallsites(Node jsRoot,
237 final DefinitionProvider provider) {
238 // Create fake function representing global execution
239 mainFunction = createFunction(jsRoot);
240
241 NodeTraversal.traverse(compiler, jsRoot, new AbstractPostOrderCallback() {
242 @Override
243 public void visit(NodeTraversal t, Node n, Node parent) {
244 int nodeType = n.getType();
245
246 if (nodeType == Token.CALL || nodeType == Token.NEW) {
247 Callsite callsite = createCallsite(n);
248
249 Node containingFunctionNode = t.getScopeRoot();
250
251 Function containingFunction =
252 functionsByNode.get(containingFunctionNode);
253
254 if (containingFunction == null) {
255 containingFunction = createFunction(containingFunctionNode);
256 }
257 callsite.containingFunction = containingFunction;
258 containingFunction.addCallsiteInFunction(callsite);
259
260 connectCallsiteToTargets(callsite, provider);
261
262 } else if (n.isFunction()) {
263 if (!functionsByNode.containsKey(n)) {
264 createFunction(n);
265 }
266 }
267 }
268 });
269 }
270
271 /**
272 * Create a Function object for given an Token.FUNCTION AST node.
273 *
274 * This is the bottleneck for Function creation: all Functions should
275 * be created with this method.
276 */
277 private Function createFunction(Node functionNode) {
278 Function function = new Function(functionNode);
279 functionsByNode.put(functionNode, function);
280
281 return function;
282 }
283
284 private Callsite createCallsite(Node callsiteNode) {
285 Callsite callsite = new Callsite(callsiteNode);
286 callsitesByNode.put(callsiteNode, callsite);
287
288 return callsite;
289 }
290
291 /**
292 * Maps a Callsite to the Function(s) it could call
293 * and each Function to the Callsite(s) that could call it.
294 *
295 * If the definitionProvider cannot determine the target of the Callsite,
296 * the Callsite's hasUnknownTarget field is set to true.
297 *
298 * If the definitionProvider determines that the target of the Callsite
299 * could be an extern-defined function, then the Callsite's hasExternTarget
300 * field is set to true.
301 *
302 * @param callsite The callsite for which target functions should be found
303 * @param definitionProvider The DefinitionProvider used to determine
304 * targets of callsites.
305 */
306 private void connectCallsiteToTargets(Callsite callsite,
307 DefinitionProvider definitionProvider) {
308 Collection<Definition> definitions =
309 lookupDefinitionsForTargetsOfCall(callsite.getAstNode(),
310 definitionProvider);
311
312 if (definitions == null) {
313 callsite.hasUnknownTarget = true;
314 } else {
315 for (Definition definition : definitions) {
316 if (definition.isExtern()) {
317 callsite.hasExternTarget = true;
318 } else {
319 Node target = definition.getRValue();
320
321 if (target != null && target.isFunction()) {
322 Function targetFunction = functionsByNode.get(target);
323
324 if (targetFunction == null) {
325 targetFunction = createFunction(target);
326 }
327
328 if (computeForwardGraph) {
329 callsite.addPossibleTarget(targetFunction);
330 }
331
332 if (computeBackwardGraph) {
333 targetFunction.addCallsitePossiblyTargetingFunction(callsite);
334 }
335 } else {
336 callsite.hasUnknownTarget = true;
337 }
338 }
339 }
340 }
341 }
342
343 /**
344 * Fills in function information (such as whether the function is ever
345 * aliased or whether it is exposed to .call or .apply) using the
346 * definition provider.
347 *
348 * We do this here, rather than when connecting the callgraph, to make sure
349 * that we have correct information for all functions, rather than just
350 * functions that are actually called.
351 */
352 private void fillInFunctionInformation(DefinitionProvider provider) {
353 if (useNameReferenceGraph) {
354 NameReferenceGraph referenceGraph = (NameReferenceGraph) provider;
355
356 for (Function function : getAllFunctions()) {
357 if (!function.isMain()) {
358 String functionName = function.getName();
359
360 if (functionName != null) {
361 Name symbol = referenceGraph.getSymbol(functionName);
362 updateFunctionForName(function, symbol);
363 }
364 }
365 }
366 } else {
367 SimpleDefinitionFinder finder = (SimpleDefinitionFinder) provider;
368
369 for (DefinitionSite definitionSite : finder.getDefinitionSites()) {
370 Definition definition = definitionSite.definition;
371
372 Function function = lookupFunctionForDefinition(definition);
373
374 if (function != null) {
375 for (UseSite useSite : finder.getUseSites(definition)) {
376 updateFunctionForUse(function, useSite.node);
377 }
378 }
379 }
380 }
381 }
382
383 /**
384 * Updates {@link Function} information (such as whether is is aliased
385 * or exposed to .apply or .call from a {@link NameReferenceGraph.Name}.
386 *
387 * Note: this method may be called multiple times per Function, each time
388 * with a different name.
389 */
390 private void updateFunctionForName(Function function, Name name) {
391 if (name.isAliased()) {
392 function.isAliased = true;
393 }
394
395 if (name.exposedToCallOrApply()) {
396 function.isExposedToCallOrApply = true;
397 }
398 }
399
400 /**
401 * Updates {@link Function} information (such as whether is is aliased
402 * or exposed to .apply or .call based a site where the function is used.
403 *
404 * Note: this method may be called multiple times per Function, each time
405 * with a different useNode.
406 */
407 private void updateFunctionForUse(Function function, Node useNode) {
408 Node useParent = useNode.getParent();
409 int parentType = useParent.getType();
410
411 if ((parentType == Token.CALL || parentType == Token.NEW)
412 && useParent.getFirstChild() == useNode) {
413 // Regular call sites don't count as aliases
414 } else if (NodeUtil.isGet(useParent)) {
415 // GET{PROP,ELEM} don't count as aliases
416 // but we have to check for using them in .call and .apply.
417
418 if (useParent.isGetProp()) {
419 Node gramps = useParent.getParent();
420 if (NodeUtil.isFunctionObjectApply(gramps) ||
421 NodeUtil.isFunctionObjectCall(gramps)) {
422 function.isExposedToCallOrApply = true;
423 }
424 }
425 } else {
426 function.isAliased = true;
427 }
428 }
429
430 /**
431 * Returns a {@link CallGraph.Function} for the passed in {@link Definition}
432 * or null if the definition isn't for a function.
433 */
434 private Function lookupFunctionForDefinition(Definition definition) {
435 if (definition != null && !definition.isExtern()) {
436 Node rValue = definition.getRValue();
437
438 if (rValue != null && rValue.isFunction()) {
439 Function function = functionsByNode.get(rValue);
440 Preconditions.checkNotNull(function);
441
442 return function;
443 }
444 }
445
446 return null;
447 }
448
449 /**
450 * Constructs and returns a directed graph where the nodes are functions and
451 * the edges are callsites connecting callers to callees.
452 *
453 * It is safe to call this method on both forward and backwardly constructed
454 * CallGraphs.
455 */
456 public DiGraph<Function, Callsite> getForwardDirectedGraph() {
457 return constructDirectedGraph(true);
458 }
459
460 /**
461 * Constructs and returns a directed graph where the nodes are functions and
462 * the edges are callsites connecting callees to callers.
463 *
464 * It is safe to call this method on both forward and backwardly constructed
465 * CallGraphs.
466 */
467 public DiGraph<Function, Callsite> getBackwardDirectedGraph() {
468 return constructDirectedGraph(false);
469 }
470
471 private static void digraphConnect(DiGraph<Function, Callsite> digraph,
472 Function caller,
473 Callsite callsite,
474 Function callee,
475 boolean forward) {
476
477 Function source;
478 Function destination;
479
480 if (forward) {
481 source = caller;
482 destination = callee;
483 } else {
484 source = callee;
485 destination = caller;
486 }
487
488 digraph.connect(source, callsite, destination);
489 }
490
491 /**
492 * Constructs a digraph of the call graph. If {@code forward} is true, then
493 * the edges in the digraph will go from callers to callees, if false then
494 * the edges will go from callees to callers.
495 *
496 * It is safe to run this method on both a forwardly constructed callgraph
497 * and a backwardly constructed callgraph, regardless of the value of
498 * {@code forward}.
499 *
500 * @param forward If true then the digraph will be a forward digraph.
501 */
502 private DiGraph<Function, Callsite> constructDirectedGraph(boolean forward) {
503 DiGraph<Function, Callsite>digraph =
504 LinkedDirectedGraph.createWithoutAnnotations();
505
506 // Create nodes in call graph
507 for (Function function : getAllFunctions()) {
508 digraph.createNode(function);
509 }
510
511 if (computeForwardGraph) {
512 // The CallGraph is a forward graph, so go from callers to callees
513 for (Function caller : getAllFunctions()) {
514 for (Callsite callsite : caller.getCallsitesInFunction()) {
515 for (Function callee : callsite.getPossibleTargets()) {
516 digraphConnect(digraph, caller, callsite, callee,
517 forward);
518 }
519 }
520 }
521 } else {
522 // The CallGraph is a backward graph, so go from callees to callers
523 for (Function callee : getAllFunctions()) {
524 for (Callsite callsite :
525 callee.getCallsitesPossiblyTargetingFunction()) {
526
527 Function caller = callsite.getContainingFunction();
528 digraphConnect(digraph, caller, callsite, callee,
529 forward);
530 }
531 }
532 }
533
534 return digraph;
535 }
536
537 /**
538 * Constructs a DefinitionProvider that can be used to determine the
539 * targets of callsites.
540 *
541 * This construction is the main cost of building the callgraph, so we offer
542 * the client a choice of NameReferenceGraph, which is slow and hopefully more
543 * precise, and SimpleDefinitionFinder, which is fast and perhaps not as
544 * precise.
545 *
546 * We use SimpleNameFinder as the default because in practice it does
547 * not appear to be less precise than NameReferenceGraph and is at least an
548 * order of magnitude faster on large compiles.
549 */
550 private DefinitionProvider constructDefinitionProvider(Node externsRoot,
551 Node jsRoot) {
552 if (useNameReferenceGraph) {
553 // Name reference graph is very, very slow
554 NameReferenceGraphConstruction graphConstruction
555 = new NameReferenceGraphConstruction(compiler);
556
557 graphConstruction.process(externsRoot, jsRoot);
558
559 return graphConstruction.getNameReferenceGraph();
560 } else {
561 SimpleDefinitionFinder defFinder = new SimpleDefinitionFinder(compiler);
562 defFinder.process(externsRoot, jsRoot);
563 return defFinder;
564 }
565 }
566
567 /**
568 * Queries the definition provider for the definitions that could be the
569 * targets of the given callsite node.
570 *
571 * This is complicated by the fact that NameReferenceGraph and
572 * SimpleDefinitionProvider (the two definition providers we currently
573 * use) differ on the types of target nodes they will analyze.
574 */
575 private Collection<Definition> lookupDefinitionsForTargetsOfCall(
576 Node callsite, DefinitionProvider definitionProvider) {
577 Preconditions.checkArgument(callsite.isCall()
578 || callsite.isNew());
579
580 Node targetExpression = callsite.getFirstChild();
581
582 // NameReferenceGraph throws an exception unless the node is
583 // a GETPROP or a NAME
584 if (!useNameReferenceGraph
585 || (targetExpression.isGetProp()
586 || targetExpression.isName())) {
587
588 Collection<Definition> definitions =
589 definitionProvider.getDefinitionsReferencedAt(targetExpression);
590
591 if (definitions != null && !definitions.isEmpty()) {
592 return definitions;
593 }
594 }
595
596 return null;
597 }
598
599 /**
600 * An inner class that represents functions in the call graph.
601 * A Function knows how to get its AST node and what Callsites
602 * it contains.
603 */
604 public class Function {
605
606 private Node astNode;
607
608 private boolean isAliased = false;
609
610 private boolean isExposedToCallOrApply = false;
611
612 private Collection<Callsite> callsitesInFunction;
613
614 private Collection<Callsite> callsitesPossiblyTargetingFunction;
615
616 private Function(Node functionAstNode) {
617 astNode = functionAstNode;
618 }
619
620 /**
621 * Does this function represent the global "main" function?
622 */
623 public boolean isMain() {
624 return (this == CallGraph.this.mainFunction);
625 }
626
627 /**
628 * Returns the underlying AST node for the function. This usually
629 * has type Token.FUNCTION but in the case of the "main" function
630 * will have type Token.BLOCK.
631 */
632 public Node getAstNode() {
633 return astNode;
634 }
635
636 /**
637 * Returns the AST node for the body of the function. If this function
638 * is the main function, it will return the global block.
639 */
640 public Node getBodyNode() {
641 if (isMain()) {
642 return astNode;
643 } else {
644 return NodeUtil.getFunctionBody(astNode);
645 }
646 }
647
648 /**
649 * Gets the name of this function. Returns null if the function is
650 * anonymous.
651 */
652 public String getName() {
653 if (isMain()) {
654 return MAIN_FUNCTION_NAME;
655 } else {
656 return NodeUtil.getFunctionName(astNode);
657 }
658 }
659
660 /**
661 * Returns the callsites in this function.
662 */
663 public Collection<Callsite> getCallsitesInFunction() {
664 if (callsitesInFunction != null) {
665 return callsitesInFunction;
666 } else {
667 return ImmutableList.of();
668 }
669 }
670
671 private void addCallsiteInFunction(Callsite callsite) {
672 if (callsitesInFunction == null) {
673 callsitesInFunction = new LinkedList<Callsite>();
674 }
675 callsitesInFunction.add(callsite);
676 }
677
678 /**
679 * Returns a collection of callsites that might call this function.
680 *
681 * getCallsitesPossiblyTargetingFunction() is a best effort only: the
682 * collection may include callsites that do not actually call this function
683 * and if this function is exported or aliased may be missing actual
684 * targets.
685 *
686 * This method should not be called on a Function from a CallGraph
687 * that was constructed with {@code computeBackwardGraph} {@code false}.
688 */
689 public Collection<Callsite> getCallsitesPossiblyTargetingFunction() {
690 if (computeBackwardGraph) {
691 if (callsitesPossiblyTargetingFunction != null) {
692 return callsitesPossiblyTargetingFunction;
693 } else {
694 return ImmutableList.of();
695 }
696 } else {
697 throw new UnsupportedOperationException("Cannot call " +
698 "getCallsitesPossiblyTargetingFunction() on a Function "
699 + "from a non-backward CallGraph");
700 }
701 }
702
703 private void addCallsitePossiblyTargetingFunction(Callsite callsite) {
704 Preconditions.checkState(computeBackwardGraph);
705 if (callsitesPossiblyTargetingFunction == null) {
706 callsitesPossiblyTargetingFunction =
707 new LinkedList<Callsite>();
708 }
709 callsitesPossiblyTargetingFunction.add(callsite);
710 }
711
712 /**
713 * Returns true if the function is aliased.
714 */
715 public boolean isAliased() {
716 return isAliased;
717 }
718
719 /**
720 * Returns true if the function is ever exposed to ".call" or ".apply".
721 */
722 public boolean isExposedToCallOrApply() {
723 return isExposedToCallOrApply;
724 }
725 }
726
727 /**
728 * An inner class that represents call sites in the call graph.
729 * A Callsite knows how to get its AST node, what its containing
730 * Function is, and what its target Functions are.
731 */
732 public class Callsite {
733 private Node astNode;
734
735 private boolean hasUnknownTarget = false;
736 private boolean hasExternTarget = false;
737
738 private Function containingFunction = null;
739
740 private Collection<Function> possibleTargets;
741
742 private Callsite(Node callsiteAstNode) {
743 astNode = callsiteAstNode;
744 }
745
746 public Node getAstNode() {
747 return astNode;
748 }
749
750 public Function getContainingFunction() {
751 return containingFunction;
752 }
753
754 /**
755 * Returns the possible target functions that this callsite could call.
756 *
757 * These targets do not include functions defined in externs. If this
758 * callsite could call an extern function, then hasExternTarget() will
759 * return true.
760 *
761 * getKnownTargets() is a best effort only: the collection may include
762 * other functions that are not actual targets and (if hasUnknownTargets()
763 * is true) may be missing actual targets.
764 *
765 * This method should not be called on a Callsite from a CallGraph
766 * that was constructed with {@code computeForwardGraph} {@code false}.
767 */
768 public Collection<Function> getPossibleTargets() {
769 if (computeForwardGraph) {
770 if (possibleTargets != null) {
771 return possibleTargets;
772 } else {
773 return ImmutableList.of();
774 }
775 } else {
776 throw new UnsupportedOperationException("Cannot call " +
777 "getPossibleTargets() on a Callsite from a non-forward " +
778 "CallGraph");
779 }
780 }
781
782 private void addPossibleTarget(Function target) {
783 Preconditions.checkState(computeForwardGraph);
784
785 if (possibleTargets == null) {
786 possibleTargets = new LinkedList<Function>();
787 }
788 possibleTargets.add(target);
789 }
790
791 /**
792 * If true, then DefinitionProvider used in callgraph construction
793 * was unable find all target functions of this callsite.
794 *
795 * If false, then getKnownTargets() contains all the possible targets of
796 * this callsite (and, perhaps, additional targets as well).
797 */
798 public boolean hasUnknownTarget() {
799 return hasUnknownTarget;
800 }
801
802 /**
803 * If true, then this callsite could target a function defined in the
804 * externs. If false, then not.
805 */
806 public boolean hasExternTarget() {
807 return hasExternTarget;
808 }
809 }
810 }