• Home
  • Raw
  • Download

Lines Matching refs:node

35 function checkDeleteStatement(node: ts.DeleteExpression): void {
36 let unaryExpr = node.expression;
42 function checkNumericLiteral(node: ts.NumericLiteral): void {
43 let num = jshelpers.getTextOfNode(node);
48 throw new DiagnosticError(node, DiagnosticCode.Octal_literals_are_not_allowed_in_strict_mode);
51 function checkString(node: ts.Node, text: string): void {
54 …throw new DiagnosticError(node, DiagnosticCode.Octal_escape_sequences_are_not_allowed_in_strict_mo…
58 throw new DiagnosticError(node, DiagnosticCode._8_and_9_are_not_allowed_in_strict_mode);
62 function checkStringLiteral(node: ts.StringLiteral): void {
64 if (stringLiteralIsInRegExp(node)) {
68 let text = jshelpers.getTextOfNode(node);
69 checkString(node, text);
88 function getStrictModeEvalOrArgumentsDiagnosticCode(node: ts.Node): any {
89 if (jshelpers.getContainingClass(node)) {
96 function getStrictModeIdentifierDiagnosticCode(node: ts.Node): any {
97 if (jshelpers.getContainingClass(node)) {
104 function checkBinaryExpression(node: ts.BinaryExpression): void {
105 if (!isLeftHandSideExpression(node.left) || !isAssignmentOperator(node.operatorToken.kind)) {
109 let contextNode = <ts.Node>node;
110 let name = node.left;
111 switch (node.left.kind) {
113 let expr = findInnerExprOfParenthesis(<ts.ParenthesizedExpression>(node.left));
125 function checkContextualIdentifier(node: ts.Identifier): void {
126 let file = jshelpers.getSourceFileOfNode(node);
127 if (jshelpers.getTextOfIdentifierOrLiteral(node) === 'await' && CmdOptions.isModules()) {
128 …throw new DiagnosticError(node, DiagnosticCode.Identifier_expected_0_is_a_reserved_word_at_the_top…
131 if (jshelpers.isIdentifierName(node)) {
135 if (isOriginalKeyword(node)) {
136 …throw new DiagnosticError(node, getStrictModeIdentifierDiagnosticCode(node), file, jshelpers.decla…
165 function checkWithStatement(node: ts.WithStatement): void {
166 let file = jshelpers.getSourceFileOfNode(node);
167 …throw new DiagnosticError(node, DiagnosticCode.A_with_statements_are_not_allowed_in_strict_mode, f…
175 function checkFunctionDeclaration(node: ts.FunctionDeclaration): void {
176 checkEvalOrArgumentsOrOriginalKeyword(node, node.name);
177 checkParameters(node);
178 if (!isInBlockScope(node.parent!)) {
179 …throw new DiagnosticError(node, DiagnosticCode.In_strict_mode_code_functions_can_only_be_declared_…
183 function checkClassDeclaration(node: ts.ClassDeclaration): void {
184 if (!hasExportKeywordModifier(node) && !node.name) {
185 if (!node.name && !hasDefaultKeywordModifier(node)) {
186 throw new DiagnosticError(node, DiagnosticCode.Identifier_expected);
191 function checkImportDeclaration(node: ts.ImportDeclaration, scope: Scope): void {
193 …throw new DiagnosticError(node, DiagnosticCode.An_import_declaration_can_only_be_used_in_a_namespa…
196 if (node.modifiers) {
197 throw new DiagnosticError(node, DiagnosticCode.An_import_declaration_cannot_have_modifiers);
200 if (node.importClause && node.importClause.namedBindings) {
201 let namedBindings = node.importClause.namedBindings;
206 … throw new DiagnosticError(node, DiagnosticCode.Unexpected_eval_or_arguments_in_strict_mode);
213 function checkExportAssignment(node: ts.ExportAssignment, scope: Scope): void {
215 …throw new DiagnosticError(node, DiagnosticCode.An_export_assignment_must_be_at_the_top_level_of_a_…
218 if (node.modifiers) {
219 throw new DiagnosticError(node, DiagnosticCode.An_export_assignment_cannot_have_modifiers);
223 function checkExportDeclaration(node: ts.ExportDeclaration, scope: Scope): void {
225 …throw new DiagnosticError(node, DiagnosticCode.An_export_declaration_can_only_be_used_in_a_module);
228 if (node.modifiers) {
229 throw new DiagnosticError(node, DiagnosticCode.An_export_declaration_cannot_have_modifiers);
233 export function checkSyntaxErrorForStrictMode(node: ts.Node, scope: Scope): void {
234 switch (node.kind) {
236 checkNumericLiteral(<ts.NumericLiteral>node);
239 checkStringLiteral(<ts.StringLiteral>node);
242 checkFunctionDeclaration(<ts.FunctionDeclaration>node);
245 let funcNode = <ts.FunctionExpression>node;
251 checkParameters(<ts.FunctionLikeDeclaration | ts.FunctionExpression>node);
254 checkClassDeclaration(<ts.ClassDeclaration>node);
257 let varNode = <ts.VariableDeclaration>node;
261 let bindNode = <ts.BindingElement>node;
262 checkEvalOrArgumentsOrOriginalKeyword(node, bindNode.name);
265 checkBinaryExpression(<ts.BinaryExpression>node);
269 let unaryNode = <ts.PrefixUnaryExpression | ts.PostfixUnaryExpression>node;
270 checkEvalOrArgumentsOrOriginalKeyword(node, unaryNode.operand);
273 checkDeleteStatement(<ts.DeleteExpression>node);
276 checkWithStatement(<ts.WithStatement>node);
279 checkContextualIdentifier(<ts.Identifier>node);
284 checkNoSubstitutionTemplateLiteral(<ts.NoSubstitutionTemplateLiteral>node);
287 checkImportDeclaration(<ts.ImportDeclaration>node, scope);
290 checkExportAssignment(<ts.ExportAssignment>node, scope);
293 checkExportDeclaration(<ts.ExportDeclaration>node, scope);