Skip to content

Commit

Permalink
Add support for creating types in JSTypeNative and JSTypes needed for
Browse files Browse the repository at this point in the history
Es6RewriteGenerators.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165596038
  • Loading branch information
EatingW authored and Tyler Breisacher committed Aug 18, 2017
1 parent a4e0150 commit 60a022f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/com/google/javascript/jscomp/newtypes/JSTypes.java
Expand Up @@ -471,6 +471,10 @@ public JSType getNativeType(JSTypeNative typeId) {
return UNDEFINED;
case NULL_TYPE:
return NULL;
case FALSE_TYPE:
return FALSE_TYPE;
case TRUE_TYPE:
return TRUE_TYPE;
case BOOLEAN_TYPE:
return BOOLEAN;
case STRING_TYPE:
Expand Down Expand Up @@ -510,6 +514,8 @@ public JSType getNativeType(JSTypeNative typeId) {
return getITemplateArrayType();
case ITERATOR_TYPE:
return getIteratorInstance(UNKNOWN);
case GENERATOR_TYPE:
return getGeneratorInstance(UNKNOWN);
default:
throw new RuntimeException("Native type " + typeId.name() + " not found");
}
Expand Down
9 changes: 8 additions & 1 deletion src/com/google/javascript/rhino/jstype/JSTypeNative.java
Expand Up @@ -81,16 +81,22 @@ public enum JSTypeNative {
DATE_TYPE,
DATE_FUNCTION_TYPE,

EMPTY_OBJECT_LITERAL_TYPE,

ERROR_FUNCTION_TYPE,
ERROR_TYPE,

EVAL_ERROR_FUNCTION_TYPE,
EVAL_ERROR_TYPE,

FALSE_TYPE,

FUNCTION_FUNCTION_TYPE,
FUNCTION_INSTANCE_TYPE, // equivalent to U2U_CONSTRUCTOR_TYPE
FUNCTION_PROTOTYPE,

GENERATOR_TYPE,

I_ITERABLE_RESULT_TYPE,
ITERATOR_TYPE,

Expand All @@ -105,7 +111,6 @@ public enum JSTypeNative {
OBJECT_TYPE,
OBJECT_FUNCTION_TYPE,
OBJECT_PROTOTYPE,
EMPTY_OBJECT_LITERAL_TYPE,

RANGE_ERROR_FUNCTION_TYPE,
RANGE_ERROR_TYPE,
Expand All @@ -123,6 +128,8 @@ public enum JSTypeNative {
SYNTAX_ERROR_FUNCTION_TYPE,
SYNTAX_ERROR_TYPE,

TRUE_TYPE,

TYPE_ERROR_FUNCTION_TYPE,
TYPE_ERROR_TYPE,

Expand Down

0 comments on commit 60a022f

Please sign in to comment.