Debian Codegraph @

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

raw symbols SCIP
1 /*
2 * Copyright 2008 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.base.Joiner;
19 import com.google.common.base.Preconditions;
20 import com.google.common.collect.Lists;
21 import com.google.common.collect.Sets;
22 import com.google.javascript.jscomp.graph.LatticeElement;
23 import com.google.javascript.rhino.Node;
24 import com.google.javascript.rhino.jstype.FunctionType;
25 import com.google.javascript.rhino.jstype.JSType;
26 import com.google.javascript.rhino.jstype.JSTypeRegistry;
27 import com.google.javascript.rhino.jstype.ObjectType;
28 import com.google.javascript.rhino.jstype.StaticScope;
29 import com.google.javascript.rhino.jstype.StaticSlot;
30 import com.google.javascript.rhino.jstype.UnknownType;
31
32 import java.util.Collection;
33 import java.util.Collections;
34 import java.util.List;
35 import java.util.Set;
36
37 /**
38 * Represents a reference type for which the exact definition in the source is
39 * known. Unlike a {@code JSType} reference type, a concrete instance type of A
40 * indicates that an instance of A -- not a subclass of A -- is a possible
41 * value. Other concrete types are functions (whose definitions are known),
42 * arrays containing concrete types, and unions of concrete types.
43 *
44 * These types are computed by {@code TightenTypes}.
45 *
46 */
47 abstract class ConcreteType implements LatticeElement {
48 /** Static instance of the empty set of concrete types. */
49 static final ConcreteType NONE = new ConcreteNoneType();
50
51 /** Static instance of the set of all concrete types. */
52 static final ConcreteType ALL = new ConcreteAll();
53
54 /** Constant empty list of function types. */
55 private static final List<ConcreteFunctionType> NO_FUNCTIONS =
56 Lists.<ConcreteFunctionType>newArrayList();
57
58 /** Constant empty list of instance types. */
59 private static final List<ConcreteInstanceType> NO_INSTANCES =
60 Lists.<ConcreteInstanceType>newArrayList();
61
62 /** Constant empty list of slots. */
63 private static final List<StaticSlot<ConcreteType>> NO_SLOTS =
64 Lists.<StaticSlot<ConcreteType>>newArrayList();
65
66 protected static ConcreteType createForTypes(Collection<ConcreteType> types) {
67 if (types == null || types.size() == 0) {
68 return NONE;
69 } else if (types.size() == 1) {
70 return types.iterator().next();
71 } else {
72 return new ConcreteUnionType(Sets.newHashSet(types));
73 }
74 }
75
76 /** Indicates whether this is an empty set of types. */
77 boolean isNone() { return false; }
78
79 /** Indicates whether this type is a function. */
80 boolean isFunction() { return false; }
81
82 /**
83 * Indicates whether this type is an instance of some type (or a prototype
84 * instance of a type).
85 * */
86 boolean isInstance() { return false; }
87
88 /** Indicates whether this type is a union of concrete types. */
89 boolean isUnion() { return false; }
90
91 /** Indicates whether this type is the set of all types. */
92 boolean isAll() { return false; }
93
94 /** Indicates whether this represents exactly one type. */
95 boolean isSingleton() { return !isNone() && !isUnion() && !isAll(); }
96
97 /** Returns this as a function, if it is one, or null, if not. */
98 ConcreteFunctionType toFunction() { return null; }
99
100 /** Returns this as an instance, if it is one, or null, if not. */
101 ConcreteInstanceType toInstance() { return null; }
102
103 /** Returns this as a union, if it is one, or null, if not. */
104 ConcreteUnionType toUnion() { return null; }
105
106 /** Returns the scope for the type, or null if not applicable. */
107 StaticScope<ConcreteType> getScope() { return null; }
108
109 /** Returns the union of this type with the given one. */
110 ConcreteType unionWith(ConcreteType other) {
111 Preconditions.checkState(this.isSingleton()); // Sets must override.
112 if (!other.isSingleton()) {
113 return other.unionWith(this);
114 } else if (equals(other)) {
115 return this;
116 } else {
117 return new ConcreteUnionType(this, other);
118 }
119 }
120
121 /** Returns the intersection of this type with the given one. */
122 ConcreteType intersectWith(ConcreteType other) {
123 if (!other.isSingleton()) {
124 return other.intersectWith(this);
125 } else if (equals(other)) {
126 return this;
127 } else {
128 return NONE;
129 }
130 }
131
132 /**
133 * Calls {@code filter()} on each type, adding it to the returned list if it
134 * is not null.
135 */
136 private <C> List<C> getMatchingTypes(TypeFilter<C> filter) {
137 C type = null;
138 if (isUnion()) {
139 List<C> list = Lists.newArrayList();
140 for (ConcreteType alt : toUnion().getAlternatives()) {
141 if ((type = filter.filter(alt)) != null) {
142 list.add(type);
143 }
144 }
145 return list;
146 } else if ((type = filter.filter(this)) != null) {
147 List<C> list = Lists.newArrayList();
148 list.add(type);
149 return list;
150 } else {
151 return filter.emptyList;
152 }
153 }
154
155 /**
156 * Provides one function to filter an input, either returning the filtered
157 * version of the input, or null if the input does not have a corresponding
158 * output.
159 */
160 abstract class TypeFilter<C> {
161 /** The empty list for a caller to use if there are no non-null outputs. */
162 final List<C> emptyList;
163
164 TypeFilter(List<C> emptyList) {
165 this.emptyList = emptyList;
166 }
167
168 abstract protected C filter(ConcreteType type);
169 }
170
171 /** Returns all function types in this set. */
172 List<ConcreteFunctionType> getFunctions() {
173 return getMatchingTypes(new TypeFilter<ConcreteFunctionType>(NO_FUNCTIONS) {
174 @Override public ConcreteFunctionType filter(ConcreteType type) {
175 return type.isFunction() ? type.toFunction() : null;
176 }
177 });
178 }
179
180 /** Returns all instance types in this set. */
181 List<ConcreteInstanceType> getInstances() {
182 return getMatchingTypes(new TypeFilter<ConcreteInstanceType>(NO_INSTANCES) {
183 @Override public ConcreteInstanceType filter(ConcreteType type) {
184 return type.isInstance() ? type.toInstance() : null;
185 }
186 });
187 }
188
189 /** Returns the (non-null) instance types of all functions in this set. */
190 List<ConcreteInstanceType> getFunctionInstanceTypes() {
191 return getMatchingTypes(new TypeFilter<ConcreteInstanceType>(NO_INSTANCES) {
192 @Override public ConcreteInstanceType filter(ConcreteType type) {
193 if (type.isFunction()) {
194 return type.toFunction().getInstanceType();
195 }
196 return null;
197 }
198 });
199 }
200
201 /** Returns all (non-null) function prototype types in this set. */
202 List<ConcreteInstanceType> getPrototypeTypes() {
203 return getMatchingTypes(new TypeFilter<ConcreteInstanceType>(NO_INSTANCES) {
204 @Override public ConcreteInstanceType filter(ConcreteType type) {
205 if (type.isInstance()
206 && type.toInstance().isFunctionPrototype()) {
207 return type.toInstance();
208 }
209 return null;
210 }
211 });
212 }
213
214 /** Returns the (non-null) superclasses of all functions in this set. */
215 List<ConcreteFunctionType> getSuperclassTypes() {
216 return getMatchingTypes(new TypeFilter<ConcreteFunctionType>(NO_FUNCTIONS) {
217 @Override public ConcreteFunctionType filter(ConcreteType type) {
218 return type.isFunction()
219 && type.toFunction().getSuperclassType() != null
220 ? type.toFunction().getSuperclassType() : null;
221 }
222 });
223 }
224
225 /** Returns the (non-null) index-th parameters of functions in this set. */
226 List<StaticSlot<ConcreteType>> getParameterSlots(final int index) {
227 return getMatchingTypes(new TypeFilter<StaticSlot<ConcreteType>>(NO_SLOTS) {
228 @Override public StaticSlot<ConcreteType> filter(ConcreteType type) {
229 return type.isFunction()
230 && toFunction().getParameterSlot(index) != null
231 ? toFunction().getParameterSlot(index) : null;
232 }
233 });
234 }
235
236 /**
237 * Returns the (non-null) slots for properties with the given name in all
238 * instance types in this set.
239 */
240 List<StaticSlot<ConcreteType>> getPropertySlots(final String name) {
241 return getMatchingTypes(new TypeFilter<StaticSlot<ConcreteType>>(NO_SLOTS) {
242 @Override public StaticSlot<ConcreteType> filter(ConcreteType type) {
243 StaticSlot<ConcreteType> slot = null;
244 if (type.isInstance()) {
245 slot = type.toInstance().getPropertySlot(name);
246 }
247 return slot;
248 }
249 });
250 }
251
252 /**
253 * Returns the concrete type for the given property from the given type.
254 * If the given type is a union type, returns the union of types for the slots
255 * of the property.
256 */
257 ConcreteType getPropertyType(final String name) {
258 ConcreteType ret = NONE;
259 for (StaticSlot<ConcreteType> slot : getPropertySlots(name)) {
260 ret = ret.unionWith(slot.getType());
261 }
262 return ret;
263 }
264
265 /** Implements the empty set of types. */
266 private static class ConcreteNoneType extends ConcreteType {
267 @Override boolean isNone() { return true; }
268
269 @Override ConcreteType unionWith(ConcreteType other) { return other; }
270
271 @Override ConcreteType intersectWith(ConcreteType other) { return NONE; }
272
273 @Override public String toString() { return "()"; }
274 }
275
276 /**
277 * Represents a specific function in the source code. Note that we assume the
278 * factory creates only a single instance of this class for a given
279 * declaration, so we do not need to override {@code Object.equals}.
280 *
281 * {@code bodyScope} contains a slot for each local variable in the function
282 * body's scope as well as special slots to keep track of whether the
283 * function is called, the this type, and the return type.
284 */
285 static class ConcreteFunctionType extends ConcreteType {
286 /** Name used for the call slot (see {@code getCallSlot}). */
287 static final String CALL_SLOT_NAME = ":call";
288
289 /** Name used for the this slot (see {@code getThisSlot}). */
290 static final String THIS_SLOT_NAME = ":this";
291
292 /** Name used for the return slot (see {@code getReturnSlot}). */
293 static final String RETURN_SLOT_NAME = ":return";
294
295 private final Factory factory;
296 private final Node declaration;
297 private final StaticScope<ConcreteType> parentScope;
298 private StaticScope<ConcreteType> bodyScope;
299 private ConcreteInstanceType instanceType;
300 private ConcreteInstanceType prototypeType;
301
302 ConcreteFunctionType(Factory factory,
303 Node declaration,
304 StaticScope<ConcreteType> parentScope) {
305 this.factory = factory;
306 this.declaration = declaration;
307 this.parentScope = parentScope;
308
309 Preconditions.checkArgument(declaration.isFunction());
310 Preconditions.checkArgument(declaration.getJSType() != null);
311 Preconditions.checkArgument(declaration.getJSType().isFunctionType());
312 }
313
314 @Override boolean isFunction() { return true; }
315
316 @Override ConcreteFunctionType toFunction() { return this; }
317
318 /**
319 * Returns the slot representing that a call to it occurred. This is
320 * assigned a type if the function is called. This ensures that the body of
321 * the function is processed even if it has no arguments or if the arguments
322 * do not take any concrete types as arguments.
323 */
324 StaticSlot<ConcreteType> getCallSlot() {
325 return getScope().getOwnSlot(CALL_SLOT_NAME);
326 }
327
328 /** Returns the slot representing the value of 'this' in the body. */
329 StaticSlot<ConcreteType> getThisSlot() {
330 return getScope().getOwnSlot(THIS_SLOT_NAME);
331 }
332
333 /** Returns the slot representing the values returned. */
334 StaticSlot<ConcreteType> getReturnSlot() {
335 return getScope().getOwnSlot(RETURN_SLOT_NAME);
336 }
337
338 /** Returns the slot representing the index-th parameter. */
339 StaticSlot<ConcreteType> getParameterSlot(int index) {
340 return getScope().getOwnSlot(getParameterName(index));
341 }
342
343 /** Returns the name for the index-th parameter within the function. */
344 private String getParameterName(int index) {
345 int count = 0;
346 for (Node n = getFirstParameter(); n != null; n = n.getNext()) {
347 if (count++ == index) {
348 return n.getString();
349 }
350 }
351 return null;
352 }
353
354 /** Returns the node containing the first parameter's name. */
355 private Node getFirstParameter() {
356 return declaration.getFirstChild().getNext().getFirstChild();
357 }
358
359 /** Returns the JSType of this function. */
360 public FunctionType getJSType() {
361 return JSType.toMaybeFunctionType(declaration.getJSType());
362 }
363
364 /**
365 * Returns the concrete type representing instances of this type or null if
366 * it has none.
367 */
368 ConcreteInstanceType getInstanceType() {
369 if (instanceType == null) {
370 if (getJSType().isConstructor()) {
371 instanceType =
372 factory.createConcreteInstance(getJSType().getInstanceType());
373 }
374 }
375 return instanceType;
376 }
377
378 /** Returns the concrete type representing the prototype of this type. */
379 ConcreteInstanceType getPrototypeType() {
380 if (prototypeType == null) {
381 prototypeType =
382 factory.createConcreteInstance(getJSType().getPrototype());
383 }
384 return prototypeType;
385 }
386
387 /** Returns the type of the superclass (or null if none exists). */
388 ConcreteFunctionType getSuperclassType() {
389 FunctionType superConstructor = getJSType().getSuperClassConstructor();
390 return (superConstructor != null)
391 ? factory.getConcreteFunction(superConstructor) : null;
392 }
393
394 /** Returns the scope for the body of this function. */
395 @Override StaticScope<ConcreteType> getScope() {
396 if (bodyScope == null) {
397 bodyScope = factory.createFunctionScope(declaration, parentScope);
398 }
399 return bodyScope;
400 }
401
402 /**
403 * Informally, a function is represented by
404 * {@code function (params): returnType} where the {@code params} is a comma
405 * separated list of types, the first one being a special
406 * {@code this:T} if the function expects a known type for {@code this}.
407 */
408 @Override public String toString() {
409 StringBuilder b = new StringBuilder(32);
410 b.append("function (");
411 boolean hasKnownTypeOfThis = !getThisSlot().getType().isNone();
412 if (hasKnownTypeOfThis) {
413 b.append("this:");
414 b.append(getThisSlot().getType().toString());
415 }
416
417 Node n = getFirstParameter();
418 if (hasKnownTypeOfThis && n != null) {
419 b.append(", ");
420 }
421 for (int i = 0; n != null; ++i, n = n.getNext()) {
422 String paramName = n.getString();
423 StaticSlot<ConcreteType> var = getScope().getOwnSlot(paramName);
424 b.append(var.getType());
425 getParameterSlot(i).getType();
426 if (n.getNext() != null) {
427 b.append(", ");
428 }
429 }
430
431 b.append(")");
432 if (getReturnSlot().getType() != null) {
433 b.append(": ");
434 b.append(getReturnSlot().getType().toString());
435 }
436 return b.toString();
437 }
438 }
439
440 /**
441 * Represents a specific constructor in the source code. Note that we assume
442 * the factory creates only a single instance of this class for a given
443 * declaration, so we do not need to override {@code Object.equals}.
444 *
445 * The {@code StaticScope} contains a slot for each property defined on the
446 * instance type and the scope parent chain follows the prototype chain
447 * hierarchy.
448 */
449 static class ConcreteInstanceType extends ConcreteType {
450 /** Factory for creating types and scopes. */
451 private final Factory factory;
452
453 /** Stores the normal type information for this instance. */
454 public final ObjectType instanceType;
455
456 /** The type information for the implicit prototype of this type, if any. */
457 private ConcreteInstanceType prototype;
458
459 /**
460 * A scope containing the properties of this instance, created on demand.
461 * Its parent scope corresponds to the scope of the implicit prototype.
462 */
463 private StaticScope<ConcreteType> scope;
464
465 ConcreteInstanceType(Factory factory, ObjectType instanceType) {
466 this.factory = factory;
467 this.instanceType = instanceType;
468
469 Preconditions.checkArgument(!(instanceType instanceof UnknownType));
470 }
471
472 @Override boolean isInstance() { return true; }
473
474 @Override ConcreteInstanceType toInstance() { return this; }
475
476 /** Determines whether this is a function prototype type. */
477 boolean isFunctionPrototype() {
478 return instanceType.isFunctionPrototypeType();
479 }
480
481 /** Returns the slot representing the property with the given name. */
482 StaticSlot<ConcreteType> getPropertySlot(String propName) {
483 return getScope().getSlot(propName);
484 }
485
486 /**
487 * Returns the closest instance type in the prototype chain that contains
488 * the given property.
489 */
490 ConcreteInstanceType getInstanceTypeWithProperty(String propName) {
491 if (getScope().getOwnSlot(propName) != null) {
492 // Normalize the instance type into the prototype, to be as
493 // consistent as possible with non-type tightened behavior.
494 //
495 // TODO(nicksantos|user): There's a larger issue here.
496 // When JSCompiler infers property types on instance types,
497 // that means that someone is just assigning a property
498 // without declaring it. In this case, we can't meaningfully
499 // tell when the property is being pulled off the subtype
500 // vs. when it's being pulled off the supertype. So we should
501 // probably invalidate properties of this sort.
502 if (instanceType.getConstructor() != null) {
503 return getConstructorType().getPrototypeType();
504 }
505 return this;
506 } else if (getImplicitPrototype() != null) {
507 return getImplicitPrototype().getInstanceTypeWithProperty(propName);
508 } else {
509 return null;
510 }
511 }
512
513 /** Returns the type representing the implicit prototype. */
514 ConcreteInstanceType getImplicitPrototype() {
515 if ((prototype == null)
516 && (instanceType.getImplicitPrototype() != null)) {
517 ObjectType proto = instanceType.getImplicitPrototype();
518 if ((proto != instanceType) && !(proto instanceof UnknownType)) {
519 prototype = factory.createConcreteInstance(proto);
520 }
521 }
522 return prototype;
523 }
524
525 /** Returns the type of the constructor or null if this has none. */
526 ConcreteFunctionType getConstructorType() {
527 if (instanceType.isFunctionPrototypeType()) {
528 return factory.getConcreteFunction(instanceType.getOwnerFunction());
529 } else {
530 FunctionType constructor = instanceType.getConstructor();
531 return (constructor != null)
532 ? factory.getConcreteFunction(constructor) : null;
533 }
534 }
535
536 /** Returns the scope of this type in the prototype chain. */
537 @Override StaticScope<ConcreteType> getScope() {
538 if (scope == null) {
539 scope = factory.createInstanceScope(instanceType);
540 }
541 return scope;
542 }
543
544 @Override public String toString() { return instanceType.toString(); }
545 }
546
547 /**
548 * Represents a finite set of possible alternatives for this type. Note that
549 * we make no effort to merge different array types into one array type, so
550 * clients should not assume there is only one array in a set.
551 */
552 static class ConcreteUnionType extends ConcreteType {
553 private final Set<ConcreteType> alternatives;
554
555 ConcreteUnionType(ConcreteType... alternatives) {
556 this(Sets.newHashSet(alternatives));
557 }
558
559 ConcreteUnionType(Set<ConcreteType> alternatives) {
560 Preconditions.checkArgument(alternatives.size() > 1);
561 this.alternatives = alternatives;
562 }
563
564 @Override boolean isUnion() { return true; }
565
566 @Override ConcreteUnionType toUnion() { return this; }
567
568 @Override ConcreteType unionWith(ConcreteType other) {
569 if (other.isSingleton()) {
570 if (alternatives.contains(other)) {
571 return this;
572 } else {
573 Set<ConcreteType> alts = Sets.newHashSet(alternatives);
574 alts.add(other);
575 return new ConcreteUnionType(alts);
576 }
577 } else if (other.isUnion()) {
578 ConcreteUnionType otherUnion = other.toUnion();
579 if (alternatives.containsAll(otherUnion.alternatives)) {
580 return this;
581 } else if (otherUnion.alternatives.containsAll(alternatives)) {
582 return otherUnion;
583 } else {
584 Set<ConcreteType> alts = Sets.newHashSet(alternatives);
585 alts.addAll(otherUnion.alternatives);
586 return new ConcreteUnionType(alts);
587 }
588 } else {
589 Preconditions.checkArgument(other.isNone() || other.isAll());
590 return other.unionWith(this);
591 }
592 }
593
594 @Override ConcreteType intersectWith(ConcreteType other) {
595 if (other.isSingleton()) {
596 if (alternatives.contains(other)) {
597 return other;
598 } else {
599 return NONE;
600 }
601 } else if (other.isUnion()) {
602 Set<ConcreteType> types = Sets.newHashSet(alternatives);
603 types.retainAll(other.toUnion().alternatives);
604 return createForTypes(types);
605 } else {
606 Preconditions.checkArgument(other.isNone() || other.isAll());
607 return other.intersectWith(this);
608 }
609 }
610
611 /** Returns all of the types in this set of alternatives. */
612 Set<ConcreteType> getAlternatives() { return alternatives; }
613
614 @Override public boolean equals(Object obj) {
615 return (obj instanceof ConcreteUnionType)
616 && alternatives.equals(((ConcreteUnionType) obj).alternatives);
617 }
618
619 @Override public int hashCode() {
620 return alternatives.hashCode() ^ 0x5f6e7d8c;
621 }
622
623 @Override public String toString() {
624 List<String> names = Lists.newArrayList();
625 for (ConcreteType type : alternatives) {
626 names.add(type.toString());
627 }
628 Collections.sort(names);
629
630 return "(" + Joiner.on(",").join(names) + ")";
631 }
632 }
633
634 /** Implements the set of all concrete types. */
635 private static class ConcreteAll extends ConcreteType {
636 @Override boolean isAll() { return true; }
637
638 @Override ConcreteType unionWith(ConcreteType other) { return this; }
639
640 @Override ConcreteType intersectWith(ConcreteType other) { return other; }
641
642 @Override public String toString() { return "*"; }
643 }
644
645 /**
646 * Represents an opaque singleton type that is different from any other.
647 * This is used by DisambiguateProperties to rename GETPROP nodes that are
648 * never reached in the TightenTypes flow analysis. This helps subsequent
649 * passes remove unreferenced properties and functions. ID passed to the
650 * constructor should be unique per-instance as it is used for generating
651 * nice, unique, names in {@code toString()}.
652 */
653 static class ConcreteUniqueType extends ConcreteType {
654 private final int id;
655
656 ConcreteUniqueType(int id) {
657 this.id = id;
658
659 Preconditions.checkArgument(id >= 0);
660 }
661
662 @Override public boolean equals(Object o) {
663 return (o instanceof ConcreteUniqueType)
664 && (id == ((ConcreteUniqueType) o).id);
665 }
666
667 @Override public int hashCode() {
668 return ConcreteUniqueType.class.hashCode() ^ id;
669 }
670
671 @Override public String toString() { return "Unique$" + id; }
672 }
673
674 /**
675 * Factory for function and instance (singleton) types and scopes. It is
676 * important that both function and instance types are singletons because
677 * callers may try to create the same one multiple times, and if multiple
678 * exist, they will not necessarily all receive the same type information.
679 */
680 interface Factory {
681 /** Returns the singleton concrete type for the given function. */
682 ConcreteFunctionType createConcreteFunction(
683 Node declaration, StaticScope<ConcreteType> parent);
684
685 /** Returns the singleton concrete type for the given instance type. */
686 ConcreteInstanceType createConcreteInstance(ObjectType instanceType);
687
688 /**
689 * Returns the already created concrete function type for the given type or
690 * null if none exists.
691 */
692 ConcreteFunctionType getConcreteFunction(FunctionType function);
693
694 /**
695 * Returns the already created concrete instance type for the given type or
696 * null if none exists.
697 */
698 ConcreteInstanceType getConcreteInstance(ObjectType instance);
699
700 /**
701 * Returns a (nested) scope for the given function. This will include
702 * slots for $call, $return, each parameter, and the slots declared in the
703 * body of the function.
704 */
705 StaticScope<ConcreteType> createFunctionScope(
706 Node declaration, StaticScope<ConcreteType> parent);
707
708 /**
709 * Returns a scope for the given instance type, nested inside the given
710 * scope of the prototype. This will include slots for each of the
711 * properties on our type.
712 */
713 StaticScope<ConcreteType> createInstanceScope(ObjectType instanceType);
714
715 /** Returns the type registry used by this factory. */
716 JSTypeRegistry getTypeRegistry();
717 }
718 }