MCPcopy Create free account
hub / github.com/davidkingzyb/SCAST / parse_function

Function parse_function

js/SCASTPY.js:417–440  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

415
416 }
417 function parse_function(){
418 input.next()
419 var r={
420 type:'FunctionDefine',
421 value:input.peek().value,
422 poi:{start:input.peek().poi.start,line:input.peek().poi.line},
423 }
424 input.next()
425 if(is_punc('('))r.arguments=parse_arguments()
426 if(is_op('->')){
427 input.next()
428 r.return=input.peek()
429 while(!is_sp(':'))input.next();
430 }
431 if(is_sp(':'))r.body=parse_block().body
432 for(let arg of r.arguments.body){
433 if(arg.value=='self'&&isclass){
434 r.type='MethodDefine'
435 break
436 }
437 }
438 // console.log('function',r)
439 return r
440 }
441 function parse_class(){
442 input.next()
443 var r={

Callers 1

parse_statementFunction · 0.70

Calls 5

is_puncFunction · 0.70
parse_argumentsFunction · 0.70
is_opFunction · 0.70
is_spFunction · 0.70
parse_blockFunction · 0.70

Tested by

no test coverage detected