Table 210. Semantic Warnings in Siebel eScript
|
|
|
Undefined identifier identifier. Global object will be used to locate the identifier. |
function main () { obj = new Object(); // obj is created without being // declared with var. } main ();
|
An undeclared variable created in a function is not locally defined. Instead, it is created as a property of the Global object. |
Variable variable might not be initialized. |
function main () { var a; TheApplication().RaiseErrorText (a); } main ();
|
The variable declared is not explicitly assigned a value. It is recommended that you initialize a variable to a default value when you declare it. For example: var a="";
In the example, you must assign the following variable a value so Siebel CRM can display it in the RaiseErrorText function: a
|
Label 'label' is unused and can be removed. |
function main () { var a = 1; labl: // labl is unused TheApplication().RaiseErrorText (a); } main ();
|
A label is defined in the function but none of the following statements use it. In this situation, you can remove this label:
|
Calling function function_label with insufficient number of arguments. |
function main () { // It is a warning condition // instead of an error if the // missing argument is not // strongly typed.*/ var c = fn (); }
function fn (a, b) { return a+b; } main ();
|
You did not provide all of the arguments that the function requires. The number of arguments you provide must equal the number of arguments specified in the function definition. |
Type conversion from data_type1 to data_type2 cannot succeed. |
function main () { var n: float = "123"; }
|
When the data type of a variable does not match the value assigned to the variable, the ST eScript engine attempts to convert the data type. This conversion process might not be successful. In the example, the following string value is assigned to a variable that is of a float data type: 123
The ST eScript engine attempts to convert this string to a float data type. |
No such method method_name. |
function main () { fn (); } main ();
|
The specified method is not defined or the method name is incorrect. In the example, you must define fn. |
Variable variable is double declared. |
Example 1
function fn () { for (var n = 0 ; n < 3 ; n++) { ...; } for (var n = 0 ; n < 3 ; n++) // n is double declared in // the scope of fn. { ...; } fn ();
Example 1
function main () { var string1 = "a string"; var string1 = "another string"; // string1 must not be redeclared. } main ();
|
A local variable is declared more than once. To avoid this warning for the common case in Example 1, you can do the following:
- Declare the counter variable outside of the for definition.
- Use the counter variable without var in the for definition.
For example: function fn () { var n; for (n = 0 ; n < 3 ; n++) { ... } for (n = 0 ; n < 3 ; n++) { ...
In Example 2, the multiple declarations result in Siebel eScript assigning each declaration that occurs after the first declaration as a simple assignment but with the unnecessary overhead of declaring a variable. Instead, you can use a simple assignment after the first declaration. For example:
string1 = "another string".
|