MCPcopy
hub / github.com/lutzroeder/netron / emitSugaredExpr

Method emitSugaredExpr

source/python.js:17406–17418  ·  view source on GitHub ↗
(tree, n_binders, type_hint)

Source from the content-addressed store, hash-verified

17404 return out_val;
17405 }
17406 emitSugaredExpr(tree, n_binders, type_hint) {
17407 if (tree instanceof ast.Name) { // TK_VAR
17408 return this.environment_stack.getSugaredVar(tree.id);
17409 } else if (tree instanceof ast.Attribute) {
17410 const sv = this.emitSugaredExpr(tree.value, 1);
17411 return sv.attr(tree.range(), this.method, tree.attr);
17412 } else if (tree instanceof ast.Call) { // TK_APPLY
17413 return this.emitApplyExpr(tree, n_binders, type_hint);
17414 } if (tree instanceof ast.Subscript) {
17415 return this.emitSubscript(tree, type_hint);
17416 }
17417 return new torch._C.SimpleValue(this.emitSimpleExpr(tree, type_hint));
17418 }
17419 emitApplyExpr(apply, n_binders, type_hint) {
17420 type_hint = type_hint || null;
17421 const sv = this.emitSugaredExpr(apply.func, 1);

Callers 10

emitStatementsMethod · 0.80
emitForMethod · 0.80
emitCondExprMethod · 0.80
emitSingleAssignmentMethod · 0.80
emitSelectAssignMethod · 0.80
emitTupleAssignMethod · 0.80
emitExprMethod · 0.80
emitApplyExprMethod · 0.80
emitApplySpecialFormMethod · 0.80
emitSubscriptMethod · 0.80

Calls 5

getSugaredVarMethod · 0.80
emitApplyExprMethod · 0.80
emitSubscriptMethod · 0.80
emitSimpleExprMethod · 0.80
attrMethod · 0.45

Tested by

no test coverage detected