| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
package stdlib |
| 7 |
|
| 8 |
import ( |
| 9 |
"context" |
| 10 |
"reflect" |
| 11 |
"time" |
| 12 |
) |
| 13 |
|
| 14 |
func init() { |
| 15 |
Symbols["context/context"] = map[string]reflect.Value{ |
| 16 |
|
| 17 |
"AfterFunc": reflect.ValueOf(context.AfterFunc), |
| 18 |
"Background": reflect.ValueOf(context.Background), |
| 19 |
"Canceled": reflect.ValueOf(&context.Canceled).Elem(), |
| 20 |
"Cause": reflect.ValueOf(context.Cause), |
| 21 |
"DeadlineExceeded": reflect.ValueOf(&context.DeadlineExceeded).Elem(), |
| 22 |
"TODO": reflect.ValueOf(context.TODO), |
| 23 |
"WithCancel": reflect.ValueOf(context.WithCancel), |
| 24 |
"WithCancelCause": reflect.ValueOf(context.WithCancelCause), |
| 25 |
"WithDeadline": reflect.ValueOf(context.WithDeadline), |
| 26 |
"WithDeadlineCause": reflect.ValueOf(context.WithDeadlineCause), |
| 27 |
"WithTimeout": reflect.ValueOf(context.WithTimeout), |
| 28 |
"WithTimeoutCause": reflect.ValueOf(context.WithTimeoutCause), |
| 29 |
"WithValue": reflect.ValueOf(context.WithValue), |
| 30 |
"WithoutCancel": reflect.ValueOf(context.WithoutCancel), |
| 31 |
|
| 32 |
|
| 33 |
"CancelCauseFunc": reflect.ValueOf((*context.CancelCauseFunc)(nil)), |
| 34 |
"CancelFunc": reflect.ValueOf((*context.CancelFunc)(nil)), |
| 35 |
"Context": reflect.ValueOf((*context.Context)(nil)), |
| 36 |
|
| 37 |
|
| 38 |
"_Context": reflect.ValueOf((*_context_Context)(nil)), |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
type _context_Context struct { |
| 44 |
IValue interface{} |
| 45 |
WDeadline func() (deadline time.Time, ok bool) |
| 46 |
WDone func() <-chan struct{} |
| 47 |
WErr func() error |
| 48 |
WValue func(key any) any |
| 49 |
} |
| 50 |
|
| 51 |
func (W _context_Context) Deadline() (deadline time.Time, ok bool) { return W.WDeadline() } |
| 52 |
func (W _context_Context) Done() <-chan struct{} { return W.WDone() } |
| 53 |
func (W _context_Context) Err() error { return W.WErr() } |
| 54 |
func (W _context_Context) Value(key any) any { return W.WValue(key) } |