Debian Codegraph @

src/com/google/javascript/jscomp/JsMessageDefinition.java

raw symbols SCIP
1 /*
2 * Copyright 2008 The Closure Compiler Authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package com.google.javascript.jscomp;
18
19 import com.google.javascript.rhino.Node;
20
21 /**
22 * Container class that holds information about JS message source.
23 *
24 * This class is specific to our JsMessage syntax. Allows you to use the
25 * new-style or the old-style messages.
26 *
27 * Old-style:
28 * <code>
29 * var MSG_LEOPARD = 'Leopard';
30 * var MSG_LEOPARD_HELP = 'The Leopard operating system';
31 * </code>
32 *
33 * New-style:
34 * <code>
35 * /** @desc The leopard operating system * /
36 * var MSG_LEOPARD = goog.getMsg('Leopard');
37 * </code>
38 *
39 * @author [email protected] (Anatol Pomazau)
40 */
41 class JsMessageDefinition {
42
43 private final Node messageNode;
44 private final Node messageParentNode;
45 private final Node visitingNode;
46
47 /**
48 * Constructs JS message definition.
49 *
50 * @param visitingNode Node that is visited by
51 * {@link JsMessageVisitor}. Take into
52 * account that visiting node could differ from the node the message
53 * was found.
54 * @param messageNode A node that contains the message. It could be node with
55 * goog.getMsg() call or string/function for old-style messages.
56 * @param messageParentNode The parent of the message node.
57 */
58 JsMessageDefinition(Node visitingNode, Node messageNode,
59 Node messageParentNode) {
60
61 this.messageNode = messageNode;
62 this.visitingNode = visitingNode;
63 this.messageParentNode = messageParentNode;
64 }
65
66 Node getMessageNode() {
67 return messageNode;
68 }
69
70 Node getVisitingNode() {
71 return visitingNode;
72 }
73
74 Node getMessageParentNode() {
75 return messageParentNode;
76 }
77 }