8b5086a2958185493ed817f3618c00d1dbc8c360
[platform/framework/web/crosswalk-tizen.git] /
1 /**
2  * @fileoverview Disallow Labeled Statements
3  * @author Nicholas C. Zakas
4  */
5 "use strict";
6
7 //------------------------------------------------------------------------------
8 // Rule Definition
9 //------------------------------------------------------------------------------
10
11 module.exports = function(context) {
12
13     //--------------------------------------------------------------------------
14     // Public
15     //--------------------------------------------------------------------------
16
17     return {
18
19         "LabeledStatement": function(node) {
20             context.report(node, "Unexpected labeled statement.");
21         },
22
23         "BreakStatement": function(node) {
24
25             if (node.label) {
26                 context.report(node, "Unexpected label in break statement.");
27             }
28
29         },
30
31         "ContinueStatement": function(node) {
32
33             if (node.label) {
34                 context.report(node, "Unexpected label in continue statement.");
35             }
36
37         }
38
39
40     };
41
42 };