/sources/js_validator.php

Description
Functions
check_js (line 176)

Check some JS code for validity.

  • return: Standard validator report output
array check_js (string $data, [boolean $raw_errors = false])
  • string $data: Code
  • boolean $raw_errors: Whether to return raw-errors
init__js_validator (line 36)

Standard code module initialisation function.

void init__js_validator ()
js_add_variable_reference (line 988)

Add a reference to a named variable.

void js_add_variable_reference (string $identifier, integer $first_mention, [boolean $instantiation = true], [boolean $reference = false], [?string $function_return = NULL])
  • string $identifier: The variable name
  • integer $first_mention: Where the first mention of the variable is
  • boolean $instantiation: Whether this is an instantation reference
  • boolean $reference: Whether this is a reference (as opposed to instantiation/setting)
  • ?string $function_return: The result-type (NULL: not a function)
js_check_assignment (line 517)

Check an assignment statement.

  • return: The assigned type
string js_check_assignment (list $c, integer $c_pos)
  • list $c: The complex assignment details
  • integer $c_pos: The position this is at in the parse
js_check_call (line 761)

Check a function call.

  • return: The return type (NULL: nothing returned)
?string js_check_call (list $c, integer $c_pos, [?string $class = NULL])
  • list $c: The (possibly complex) variable that is the function identifier
  • integer $c_pos: The position this is at in the parse
  • ?string $class: The class the given variable is in (NULL: global/as-specified-internally-in-c)
js_check_command (line 376)

Check a parsed command.

void js_check_command (list $command, integer $depth)
  • list $command: The command
  • integer $depth: The block depth we are searching at
js_check_expression (line 568)

Check an expression.

  • return: The type
string js_check_expression (list $e, [boolean $secondary = false])
  • list $e: The complex expression
  • boolean $secondary: Whether the expression is being used as a command (i.e. whether the expression is not used for the result, but rather, the secondary consequences of calculating it)
js_check_function (line 272)

Check a function declaration.

void js_check_function (map $function)
  • map $function: The function details
js_check_variable (line 787)

Check a variable.

  • return: The return type and possibly function return type (if requested)
mixed js_check_variable (list $variable, [boolean $reference = false], [boolean $function_duality = false], [?string $class = NULL], [boolean $allow_static = false])
  • list $variable: The (possibly complex) variable
  • boolean $reference: Whether the variable is being used referentially (i.e. not being set)
  • boolean $function_duality: Whether to return the type and function-return-type pair, rather than just the type
  • ?string $class: The class the variable is referencing within (NULL: global)
  • boolean $allow_static: Whether the given class is being referenced directly in static form
js_check_variable_list (line 309)

Check a variable list for consistency.

void js_check_variable_list (list $JS_LOCAL_VARIABLES)
  • list $JS_LOCAL_VARIABLES: The variable list
js_ensure_type (line 1031)

Do type checking for something specific.

  • return: Whether it type-checks
boolean js_ensure_type (list $_allowed_types, string $actual_type, integer $pos, [?string $alt_error = NULL])
  • list $_allowed_types: List of allowed types
  • string $actual_type: Actual type involved
  • integer $pos: Current parse position
  • ?string $alt_error: Specific error message to give (NULL: use default)
js_get_variable_type (line 950)

Get the type of a variable.

  • return: The type
string js_get_variable_type (list $variable)
  • list $variable: The variable
js_infer_expression_type_to_variable_type (line 1011)

If the given expression is a direct variable expression, this function will infer the type as the given type. This therefore allows type infering on usage as well as on assignment.

void js_infer_expression_type_to_variable_type (string $type, list $expr)
  • string $type: The type
  • list $expr: The expression
js_scan_extractive_expressions (line 931)

Scan through a complex variable, checking any expressions embedded in it.

void js_scan_extractive_expressions (list $variable)
  • list $variable: The complex variable
js_set_ocportal_type (line 973)

Add a type to the list of used types for a variable.

void js_set_ocportal_type (string $identifier, string $type)
  • string $identifier: The variable name
  • string $type: The type
reset_js_global_variables (line 151)

Return the global variable array to the defaults.

void reset_js_global_variables ()
_check_js (line 234)

Do the actual code check on the parse structure.

void _check_js (map $structure)
  • map $structure: Parse structure

Documentation generated on Sun, 02 Jan 2011 23:16:55 +0000 by phpDocumentor 1.4.3