The older I get, the less important the comma becomes. Let the reader decide for himself where to pause. - Elizabeth Clarkson Zwart
/*
* , .
* , ,
* ,
* . , , .
* , ,
* , .
*
* . , , ,
* , .
* , -
* .
*/
counter++; //
/*
* .
* ,
* .
* βrefβ,
* .
* ,
* βposβ. ,
* .
*/
char* pos = buffer; //
/*
, ...
*/
, , , , , , , . - , , , ...
. , , . .
(defun js2-parse-variables (in-for decl-type)
" 'var', 'const' 'let' for-loop .
IN-FOR , init- for-.
DECL-TYPE : VAR CONST LET, .
"
(let ((result (make-js2-var-decl-node))
destructuring-init
destructuring
s start tt init name node
(continue t))
;; :
;; var foo = {a: 1, b: 2}, bar = [3, 4];
;; var {b: s2, a: s1} = foo, x = 6, y, [s3, s4] = bar;
(while continue
(setq destructuring nil
s nil
tt (js2-peek-token)
start js2-token-start
init nil)
(if (or (= tt js2-LB) (= tt js2-LC))
;; , , var [a, b] = ...
(setq destructuring (js2-parse-primary-expr))
;;
(js2-must-match js2-NAME "msg.bad.var")
(setq name (make-js2-name-node))
(js2-define-symbol decl-type js2-ts-string))
(when (js2-match-token js2-ASSIGN)
(setq init (js2-parse-assign-expr in-for)))
(if destructuring
(progn
(if (null init)
;; (var [k, v] in foo) -
(unless in-for
(js2-report-error "msg.destruct.assign.no.init")))
(setq node (make-js2-destructuring-init-node :start start
:end js2-ts-cursor
:lhs destructuring
:initializer init))
(js2-node-add-children node destructuring init))
;; ,
(setq node (make-js2-var-init-node :start start
:end js2-ts-cursor
:name name
:initializer init))
(js2-node-add-children node name init))
(js2-block-node-push result node)
(js2-node-add-children result node)
(unless (js2-match-token js2-COMMA)
(setq continue nil)))
result))
β¦ Struts 1 . , Ajax, .
MyFunctionCallResult
ValueOne
ValueTwo
(, )? ( ) , ?Source: https://habr.com/ru/post/127635/
All Articles