Skip to content

[New features] Primitive types and struct type #5879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
f947900
prim type and struct backend
wangyanxing Oct 23, 2015
d34b4e2
lint
wangyanxing Oct 23, 2015
8c900c6
bug fixed
wangyanxing Oct 29, 2015
57c540f
add struct to types.ts
JieD Nov 2, 2015
7f1df2c
add struct to parser.ts
JieD Nov 2, 2015
4404b30
add struct to binder.ts
JieD Nov 2, 2015
8de38fa
add struct to emiter.ts
JieD Nov 2, 2015
6cbeb18
lint
JieD Nov 2, 2015
24946b7
add struct to utilities.ts and lint
JieD Nov 2, 2015
8564dcd
add struct to checker and partial lint
JieD Nov 2, 2015
993c238
struct expression enables and struct body with statemetns not allowed
JieD Nov 5, 2015
e5147a3
struct expression test
JieD Nov 5, 2015
07118de
test - struct with predefined types as names
JieD Nov 5, 2015
1daf34e
tests - struct has the same name as class, interface and variables
JieD Nov 5, 2015
8584cf0
test - struct has members of JS objects
JieD Nov 5, 2015
28975a5
tests - struct cannot extend primitives
JieD Nov 5, 2015
f63d723
struct empty body - assgin to different types
JieD Nov 6, 2015
d539022
struct extends structs
JieD Nov 6, 2015
61073fc
tests - struct entends1
JieD Nov 6, 2015
423fd44
struct extends or implements
JieD Nov 6, 2015
5b4e768
struct extends shadowed constructor
JieD Nov 6, 2015
0682db0
add struct type
JieD Nov 6, 2015
74696d5
add struct
JieD Nov 6, 2015
a65e4f7
struct cannot implement
JieD Nov 6, 2015
8644963
partial lint
JieD Nov 6, 2015
a365b11
TypeFlags.Struct - needs to assign a unique value
JieD Nov 6, 2015
6ee8c46
struct extends structs
JieD Nov 6, 2015
fcace4f
struct inheritance checking - ignore declaration & revert lint for ea…
JieD Nov 6, 2015
5699303
struct extends
JieD Nov 6, 2015
6f48862
check base types
JieD Nov 7, 2015
de08389
instance and static members
JieD Nov 7, 2015
65fb764
protected not allowed on struct members
JieD Nov 7, 2015
7924ee9
protected not allowed on struct members
JieD Nov 7, 2015
420998d
struct private and public properties
JieD Nov 7, 2015
1cf16ab
modifiers - only protected for struct
JieD Nov 7, 2015
a11f0ec
struct private members
JieD Nov 7, 2015
19db1ca
struct accessors and accessibility
JieD Nov 25, 2015
966e102
struct not allow index members
JieD Nov 25, 2015
1c98569
struct tests
JieD Nov 26, 2015
405c9fa
struct array
JieD Nov 26, 2015
8998314
automatic generated changes
JieD Nov 26, 2015
2f0539e
lint
JieD Nov 26, 2015
b645884
merge conflicts
JieD Nov 26, 2015
a714a03
test baseline
JieD Nov 26, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ rwc-report.html
*.swp
build.json
*.actual
mytests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove this? I'm not sure why it's here.

tests/webhost/*.d.ts
tests/webhost/webtsc.js
tests/*.js
Expand Down
38 changes: 19 additions & 19 deletions lib/tsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ var ts;
Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: ts.DiagnosticCategory.Error, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." },
Generic_type_0_requires_1_type_argument_s: { code: 2314, category: ts.DiagnosticCategory.Error, key: "Generic type '{0}' requires {1} type argument(s)." },
Type_0_is_not_generic: { code: 2315, category: ts.DiagnosticCategory.Error, key: "Type '{0}' is not generic." },
Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: ts.DiagnosticCategory.Error, key: "Global type '{0}' must be a class or interface type." },
Global_type_0_must_be_a_class_or_struct_or_interface_type: { code: 2316, category: ts.DiagnosticCategory.Error, key: "Global type '{0}' must be a class or interface type." },
Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: ts.DiagnosticCategory.Error, key: "Global type '{0}' must have {1} type parameter(s)." },
Cannot_find_global_type_0: { code: 2318, category: ts.DiagnosticCategory.Error, key: "Cannot find global type '{0}'." },
Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: ts.DiagnosticCategory.Error, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." },
Expand Down Expand Up @@ -1428,8 +1428,8 @@ var ts;
Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: "Interface '{0}' incorrectly extends interface '{1}'." },
Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum name cannot be '{0}'" },
In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." },
A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be in a different file from a class or function with which it is merged" },
A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be located prior to a class or function with which it is merged" },
A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_struct_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be in a different file from a class or function with which it is merged" },
A_namespace_declaration_cannot_be_located_prior_to_a_class_or_struct_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be located prior to a class or function with which it is merged" },
Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient modules cannot be nested in other modules or namespaces." },
Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient module declaration cannot specify relative module name." },
Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module '{0}' is hidden by a local declaration with the same name" },
Expand Down Expand Up @@ -4916,7 +4916,7 @@ var ts;
var heritageClause = getHeritageClause(node.heritageClauses, 83);
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
}
ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement;
ts.getClassOrStructExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement;
function getClassImplementsHeritageClauseElements(node) {
var heritageClause = getHeritageClause(node.heritageClauses, 106);
return heritageClause ? heritageClause.types : undefined;
Expand Down Expand Up @@ -5532,7 +5532,7 @@ var ts;
node.parent.token === 83 &&
isClassLike(node.parent.parent);
}
ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause;
ts.isExpressionWithTypeArgumentsInClassOrStructExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause;
function isSupportedExpressionWithTypeArguments(node) {
return isSupportedExpressionWithTypeArgumentsRest(node.expression);
}
Expand Down Expand Up @@ -12593,7 +12593,7 @@ var ts;
return type.flags & 80896 && getSignaturesOfType(type, 1).length > 0;
}
function getBaseTypeNodeOfClass(type) {
return ts.getClassExtendsHeritageClauseElement(type.symbol.valueDeclaration);
return ts.getClassOrStructExtendsHeritageClauseElement(type.symbol.valueDeclaration);
}
function getConstructorsForTypeArguments(type, typeArgumentNodes) {
var typeArgCount = typeArgumentNodes ? typeArgumentNodes.length : 0;
Expand Down Expand Up @@ -13740,7 +13740,7 @@ var ts;
}
var type = getDeclaredTypeOfSymbol(symbol);
if (!(type.flags & 80896)) {
error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name);
error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_struct_or_interface_type, symbol.name);
return arity ? emptyGenericType : emptyObjectType;
}
if ((type.typeParameters ? type.typeParameters.length : 0) !== arity) {
Expand Down Expand Up @@ -15855,7 +15855,7 @@ var ts;
}
}
if (!baseClassType) {
if (!classDeclaration || !ts.getClassExtendsHeritageClauseElement(classDeclaration)) {
if (!classDeclaration || !ts.getClassOrStructExtendsHeritageClauseElement(classDeclaration)) {
error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class);
}
return unknownType;
Expand Down Expand Up @@ -17452,7 +17452,7 @@ var ts;
if (node.expression.kind === 95) {
var superType = checkSuperExpression(node.expression);
if (superType !== unknownType) {
var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node));
var baseTypeNode = ts.getClassOrStructExtendsHeritageClauseElement(ts.getContainingClass(node));
var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments);
return resolveCall(node, baseConstructors, candidatesOutArray);
}
Expand Down Expand Up @@ -18757,7 +18757,7 @@ var ts;
!!n.initializer;
}
var containingClassDecl = node.parent;
if (ts.getClassExtendsHeritageClauseElement(containingClassDecl)) {
if (ts.getClassOrStructExtendsHeritageClauseElement(containingClassDecl)) {
var containingClassSymbol = getSymbolOfNode(containingClassDecl);
var containingClassInstanceType = getDeclaredTypeOfSymbol(containingClassSymbol);
var baseConstructorType = getBaseConstructorTypeOfClass(containingClassInstanceType);
Expand Down Expand Up @@ -19481,7 +19481,7 @@ var ts;
if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) {
return;
}
if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) {
if (ts.getClassOrStructExtendsHeritageClauseElement(enclosingClass)) {
var isDeclaration_2 = node.kind !== 69;
if (isDeclaration_2) {
error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference);
Expand Down Expand Up @@ -20121,7 +20121,7 @@ var ts;
var type = getDeclaredTypeOfSymbol(symbol);
var typeWithThis = getTypeWithThisArgument(type);
var staticType = getTypeOfSymbol(symbol);
var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node);
var baseTypeNode = ts.getClassOrStructExtendsHeritageClauseElement(node);
if (baseTypeNode) {
emitExtends = emitExtends || !ts.isInAmbientContext(node);
var baseTypes = getBaseTypes(type);
Expand Down Expand Up @@ -20606,10 +20606,10 @@ var ts;
var firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);
if (firstNonAmbientClassOrFunc) {
if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(firstNonAmbientClassOrFunc)) {
error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged);
error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_struct_or_function_with_which_it_is_merged);
}
else if (node.pos < firstNonAmbientClassOrFunc.pos) {
error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged);
error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_struct_or_function_with_which_it_is_merged);
}
}
var mergedClass = ts.getDeclarationOfKind(symbol, 214);
Expand Down Expand Up @@ -21265,7 +21265,7 @@ var ts;
var meaning = 0;
if (entityName.parent.kind === 188) {
meaning = 793056;
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
if (ts.isExpressionWithTypeArgumentsInClassOrStructExtendsClause(entityName.parent)) {
meaning |= 107455;
}
}
Expand Down Expand Up @@ -21391,7 +21391,7 @@ var ts;
if (ts.isExpression(node)) {
return getTypeOfExpression(node);
}
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) {
if (ts.isExpressionWithTypeArgumentsInClassOrStructExtendsClause(node)) {
return getBaseTypes(getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0];
}
if (isTypeDeclaration(node)) {
Expand Down Expand Up @@ -23484,7 +23484,7 @@ var ts;
var prevEnclosingDeclaration = enclosingDeclaration;
enclosingDeclaration = node;
emitTypeParameters(node.typeParameters);
var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node);
var baseTypeNode = ts.getClassOrStructExtendsHeritageClauseElement(node);
if (baseTypeNode) {
emitHeritageClause([baseTypeNode], false);
}
Expand Down Expand Up @@ -27749,7 +27749,7 @@ var ts;
write(" ");
emitDeclarationName(node);
}
var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node);
var baseTypeNode = ts.getClassOrStructExtendsHeritageClauseElement(node);
if (baseTypeNode) {
write(" extends ");
emit(baseTypeNode.expression);
Expand Down Expand Up @@ -27810,7 +27810,7 @@ var ts;
write(" = ");
}
write("(function (");
var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node);
var baseTypeNode = ts.getClassOrStructExtendsHeritageClauseElement(node);
if (baseTypeNode) {
write("_super");
}
Expand Down
Loading