transform: optimize reflect.Type Implements() method

This commit adds a new transform that converts reflect Implements()
calls to runtime.interfaceImplements. At the moment, the Implements()
method is not yet implemented (how ironic) but if the value passed to
Implements is known at compile time the method call can be optimized to
runtime.interfaceImplements to make it a regular interface assert.

This commit is the last change necessary to add basic support for the
encoding/json package. The json package is certainly not yet fully
supported, but some trivial objects can be converted to JSON.
This commit is contained in:
Ayke van Laethem
2021-03-24 16:07:44 +01:00
committed by Ron Evans
parent c5ec955081
commit bcce296ca3
12 changed files with 242 additions and 8 deletions
+4
View File
@@ -0,0 +1,4 @@
int: 3
float64: 3.14
string: "foo"
slice of strings: ["foo","bar"]