Skip to content

Strict mode support #217

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

Merged
merged 20 commits into from
Jul 24, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
8cbe88b
Give a semantic error on with statements
JsonFreeman Jul 22, 2014
f79cba2
Type check the expression of the 'with' statement
JsonFreeman Jul 22, 2014
0550b93
Allow reserved words in type queries.
ahejlsberg Jul 22, 2014
1c594d0
Addressing CR feedback.
ahejlsberg Jul 23, 2014
d10f2e7
do not propagate property name as name for function expression
vladima Jul 23, 2014
ed3d740
Merge branch 'master' into errorOnWithStatement
JsonFreeman Jul 23, 2014
29284cb
Merge branch 'master' into errorOnWithStatement
JsonFreeman Jul 23, 2014
bc26d48
Merge pull request #176 from Microsoft/errorOnWithStatement
JsonFreeman Jul 23, 2014
259f8a2
enabled strict mode
vladima Jul 23, 2014
e742694
Merge pull request #199 from Microsoft/reservedWordsInTypeQueries
ahejlsberg Jul 23, 2014
ddfd0fe
update check for object literal properties according to ECMA spec
vladima Jul 23, 2014
439ee1e
Merge pull request #223 from Microsoft/linuxTestFixes
danquirk Jul 24, 2014
71336fc
Add error handler to better debug issues when jake launches external …
danquirk Jul 24, 2014
64ab02e
Make sure we delete projects tests baselines on errors in jake
danquirk Jul 24, 2014
c369e25
added comments
vladima Jul 24, 2014
9112a0e
enabled strict mode
vladima Jul 23, 2014
6572c82
update check for object literal properties according to ECMA spec
vladima Jul 23, 2014
48ff939
added comments
vladima Jul 24, 2014
7072711
updated test baselines
vladima Jul 24, 2014
4c70d73
Merge remote-tracking branch 'origin/strict_mode' into strict_mode
vladima Jul 24, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Jakefile
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,11 @@ function exec(cmd, completeHandler) {
}
complete();
});
ex.addListener("error", function(e, status) {
process.stderr.write(status);
process.stderr.write(e);
complete();
})
try{
ex.run();
} catch(e) {
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5284,7 +5284,7 @@ module ts {

function checkWithStatement(node: WithStatement) {
checkExpression(node.expression);
checkSourceElement(node.statement);
error(node.expression, Diagnostics.All_symbols_within_a_with_block_will_be_resolved_to_any);
}

function checkSwitchStatement(node: SwitchStatement) {
Expand Down
4 changes: 4 additions & 0 deletions src/compiler/diagnosticInformationMap.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ module ts {
A_constructor_implementation_cannot_be_declared_in_an_ambient_context: { code: 1111, category: DiagnosticCategory.Error, key: "A constructor implementation cannot be declared in an ambient context." },
A_class_member_cannot_be_declared_optional: { code: 1112, category: DiagnosticCategory.Error, key: "A class member cannot be declared optional." },
A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: DiagnosticCategory.Error, key: "A 'default' clause cannot appear more than once in a 'switch' statement." },
An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1114, category: DiagnosticCategory.Error, key: "An object literal cannot have multiple properties with the same name in strict mode." },
An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1115, category: DiagnosticCategory.Error, key: "An object literal cannot have multiple get/set accessors with the same name." },
An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1116, category: DiagnosticCategory.Error, key: "An object literal cannot have property and accessor with the same name." },
Duplicate_identifier_0: { code: 2000, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 2068, category: DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead." },
Multiple_constructor_implementations_are_not_allowed: { code: 2070, category: DiagnosticCategory.Error, key: "Multiple constructor implementations are not allowed." },
Expand All @@ -123,6 +126,7 @@ module ts {
Setters_cannot_return_a_value: { code: 2122, category: DiagnosticCategory.Error, key: "Setters cannot return a value." },
Invalid_left_hand_side_of_assignment_expression: { code: 2130, category: DiagnosticCategory.Error, key: "Invalid left-hand side of assignment expression." },
Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2134, category: DiagnosticCategory.Error, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." },
All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2135, category: DiagnosticCategory.Error, key: "All symbols within a 'with' block will be resolved to 'any'." },
The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2139, category: DiagnosticCategory.Error, key: "The operand of an increment or decrement operator must be a variable, property or indexer." },
Overload_signatures_must_all_be_public_or_private: { code: 2150, category: DiagnosticCategory.Error, key: "Overload signatures must all be public or private." },
Overload_signatures_must_all_be_exported_or_not_exported: { code: 2151, category: DiagnosticCategory.Error, key: "Overload signatures must all be exported or not exported." },
Expand Down
17 changes: 16 additions & 1 deletion src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,18 @@
"category": "Error",
"code": 1113
},

"An object literal cannot have multiple properties with the same name in strict mode.": {
"category": "Error",
"code": 1114
},
"An object literal cannot have multiple get/set accessors with the same name.": {
"category": "Error",
"code": 1115
},
"An object literal cannot have property and accessor with the same name.": {
"category": "Error",
"code": 1116
},
"Duplicate identifier '{0}'.": {
"category": "Error",
"code": 2000
Expand Down Expand Up @@ -485,6 +496,10 @@
"category": "Error",
"code": 2134
},
"All symbols within a 'with' block will be resolved to 'any'.": {
"category": "Error",
"code": 2135
},
"The operand of an increment or decrement operator must be a variable, property or indexer.": {
"category": "Error",
"code": 2139
Expand Down
3 changes: 1 addition & 2 deletions src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1669,8 +1669,7 @@ module ts {

function emitDirectivePrologues(statements: Statement[], startWithNewLine: boolean): number {
for (var i = 0; i < statements.length; ++i) {
if (statements[i].kind === SyntaxKind.ExpressionStatement &&
(<ExpressionStatement>statements[i]).expression.kind === SyntaxKind.StringLiteral) {
if (isPrologueDirective(statements[i])) {
if (startWithNewLine || i > 0) {
writeLine();
}
Expand Down
Loading