Skip to content

Commit

Permalink
Diagnostics for decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuckton committed Mar 17, 2015
1 parent fb7dd52 commit efd8a89
Show file tree
Hide file tree
Showing 10 changed files with 1,786 additions and 1,529 deletions.
5 changes: 5 additions & 0 deletions src/compiler/diagnosticInformationMap.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ module ts {
Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." },
Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." },
Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile external modules into amd or commonjs when targeting es6 or higher." },
Decorators_are_only_supported_on_class_members_when_targeting_ECMAScript_5_or_higher: { code: 1205, category: DiagnosticCategory.Error, key: "Decorators are only supported on class members when targeting ECMAScript 5 or higher." },
Decorators_are_not_valid_on_this_declaration_type: { code: 1206, category: DiagnosticCategory.Error, key: "Decorators are not valid on this declaration type." },
Argument_to_ambient_decorator_must_be_constant_expression: { code: 1207, category: DiagnosticCategory.Error, key: "Argument to ambient decorator must be constant expression." },

This comment has been minimized.

Copy link
@mhegazy

mhegazy Mar 18, 2015

Contributor

not needed

Decorators_may_not_change_the_type_of_a_member: { code: 1208, category: DiagnosticCategory.Error, key: "Decorators may not change the type of a member." },
Decorators_may_not_change_the_type_of_a_class: { code: 1209, category: DiagnosticCategory.Error, key: "Decorators may not change the type of a class." },
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
Expand Down
20 changes: 20 additions & 0 deletions src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,26 @@
"category": "Error",
"code": 1204
},
"Decorators are only supported on class members when targeting ECMAScript 5 or higher.": {

This comment has been minimized.

Copy link
@JsonFreeman

JsonFreeman Mar 18, 2015

Contributor

The placement of 'only' is ambiguous here (between 'only on class members' and 'only on ES5'). I would rephrase it to something like:

"Decorators on class members are only available when targeting ... "

"category": "Error",
"code": 1205
},
"Decorators are not valid on this declaration type.": {

This comment has been minimized.

Copy link
@JsonFreeman

JsonFreeman Mar 18, 2015

Contributor

"A decorator cannot be used on this declaration type."

Also, is there a way to avoid using the word "type" here?

"category": "Error",
"code": 1206
},
"Argument to ambient decorator must be constant expression.": {

This comment has been minimized.

Copy link
@JsonFreeman

JsonFreeman Mar 18, 2015

Contributor

The arguments to an ambient decorator must be constant expressions.

or

Only constant expressions can be used as arguments for an ambient decorator

"category": "Error",
"code": 1207
},
"Decorators may not change the type of a member.": {

This comment has been minimized.

Copy link
@JsonFreeman

JsonFreeman Mar 18, 2015

Contributor

A decorator

"category": "Error",
"code": 1208
},
"Decorators may not change the type of a class.": {

This comment has been minimized.

Copy link
@JsonFreeman

JsonFreeman Mar 18, 2015

Contributor

A decorator

"category": "Error",
"code": 1209
},

"Duplicate identifier '{0}'.": {
"category": "Error",
Expand Down
Loading

0 comments on commit efd8a89

Please sign in to comment.