@@ -100,7 +100,10 @@ compile_labelAbstractTypes <- function(code,
100100 return (invisible (NULL ))
101101 }
102102
103- handlingInfo <- getOperatorDef(code $ name , " labelAbstractTypes" )
103+ opInfo <- check_cachedOpInfo(code , where = auxEnv $ where , update = TRUE )
104+ handlingInfo <- getOperatorField(opInfo $ opDef , " labelAbstractTypes" )
105+
106+ # handlingInfo <- getOperatorDef(code$name, "labelAbstractTypes")
104107 # opInfo <- operatorDefEnv[[code$name]]
105108 # if(!is.null(opInfo)) {
106109 # handlingInfo <- opInfo[["labelAbstractTypes"]]
@@ -109,8 +112,11 @@ compile_labelAbstractTypes <- function(code,
109112 if (! is.null(handler )) {
110113 if (logging )
111114 appendToLog(paste(' Calling handler' , handler , ' for' , code $ name ))
112- ans <- eval(call(handler , code , symTab , auxEnv , handlingInfo ),
113- envir = labelAbstractTypesEnv )
115+ if (is.function(handler ))
116+ ans <- handler(code , symTab , auxEnv , handlingInfo )
117+ else
118+ ans <- eval(call(handler , code , symTab , auxEnv , handlingInfo ),
119+ envir = labelAbstractTypesEnv )
114120 nErrorEnv $ stateInfo <- character ()
115121 if (logging ) {
116122 appendToLog(paste(' Finished handling' , handler , ' for' , code $ name ))
@@ -406,24 +412,11 @@ inLabelAbstractTypesEnv(
406412inLabelAbstractTypesEnv(
407413 nFunction_or_method_call <-
408414 function (code , symTab , auxEnv , handlingInfo ) {
409- # We have code = NFCALL_(foo(x, y))
410- # innerCall if foo(x,y)
411- # We'll set innerCall$type to symbolNF
412- # and we'll set code$type to the returnType of foo(x, y)
413- innerCall <- code $ args [[' call' ]]
414- if (is.null(innerCall ))
415- stop(
416- exprClassProcessingErrorMsg(
417- code , paste(' In nFunction_or_method_call: the nFunction (or method) ' ,
418- code $ name ,
419- ' has NULL content.' )
420- ), call. = FALSE
421- )
422- inserts <- recurse_labelAbstractTypes(innerCall , symTab , auxEnv ,
415+ inserts <- recurse_labelAbstractTypes(code , symTab , auxEnv ,
423416 handlingInfo )
424- obj_internals <- code $ aux $ obj_internals
425- nFunctionName <- code $ aux $ nFunctionName
426- innerCall $ type <- symbolNF $ new(name = nFunctionName )
417+ obj_internals <- code $ aux $ cachedOpInfo $ obj_internals
418+ # nFunctionName <- obj_internals $nFunctionName
419+ # code$aux$symbolNF <- symbolNF$new(name = nFunctionName)
427420 returnSym <- obj_internals $ returnSym
428421 if (is.null(returnSym ))
429422 stop(
@@ -435,24 +428,6 @@ inLabelAbstractTypesEnv(
435428 )
436429 code $ type <- returnSym $ clone() # # Not sure if a clone is needed, but it seems safer to make one.
437430 inserts
438-
439- # useArgs <- c(FALSE, rep(TRUE, length(code$args)-1))
440- # inserts <- recurse_labelAbstractTypes(code, symTab, auxEnv,
441- # handlingInfo, useArgs)
442- # obj_internals <- code$args[[1]]$aux$obj_internals
443- # nFunctionName <- code$args[[1]]$aux$nFunctionName
444- # code$args[[1]]$type <- symbolNF$new(name = nFunctionName)
445- # returnSym <- obj_internals$returnSym
446- # if(is.null(returnSym))
447- # stop(
448- # exprClassProcessingErrorMsg(
449- # code, paste('In nFunction_or_method_call: the nFunction (or method) ',
450- # code$name,
451- # ' does not have a valid returnType.')
452- # ), call. = FALSE
453- # )
454- # code$type <- returnSym$clone() ## Not sure if a clone is needed, but it seems safer to make one.
455- # invisible(NULL)
456431 }
457432)
458433
0 commit comments