bind: ignore type aliases to basic types
Fixes golang/go#29559 Change-Id: Iffaac239e5c9a9e53f4e292b4d9bf669d5084e1f GitHub-Last-Rev: c5d4a4823d2bf60fa7bff09ab7bbdc9235c49d67 GitHub-Pull-Request: golang/mobile#25 Reviewed-on: https://go-review.googlesource.com/c/159417 Reviewed-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
parent
07b47c2b9c
commit
feefccb6c1
|
@ -39,6 +39,7 @@ var tests = []string{
|
|||
"testdata/issue10788.go",
|
||||
"testdata/issue12328.go",
|
||||
"testdata/issue12403.go",
|
||||
"testdata/issue29559.go",
|
||||
"testdata/keywords.go",
|
||||
"testdata/try.go",
|
||||
"testdata/vars.go",
|
||||
|
|
10
bind/gen.go
10
bind/gen.go
|
@ -146,7 +146,10 @@ func (g *Generator) Init() {
|
|||
g.funcs = append(g.funcs, obj)
|
||||
}
|
||||
case *types.TypeName:
|
||||
named := obj.Type().(*types.Named)
|
||||
named, ok := obj.Type().(*types.Named)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
switch t := named.Underlying().(type) {
|
||||
case *types.Struct:
|
||||
g.structs = append(g.structs, structInfo{obj, t})
|
||||
|
@ -180,7 +183,10 @@ func (g *Generator) Init() {
|
|||
continue
|
||||
}
|
||||
if obj, ok := obj.(*types.TypeName); ok {
|
||||
named := obj.Type().(*types.Named)
|
||||
named, ok := obj.Type().(*types.Named)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if t, ok := named.Underlying().(*types.Interface); ok {
|
||||
g.allIntf = append(g.allIntf, interfaceInfo{obj, t, makeIfaceSummary(t)})
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package issue29559
|
||||
|
||||
type AString = string
|
||||
|
||||
func TakesAString(s AString) {}
|
|
@ -0,0 +1,28 @@
|
|||
// Package main is an autogenerated binder stub for package issue29559.
|
||||
// gobind -lang=go issue29559
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
package main
|
||||
|
||||
/*
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "seq.h"
|
||||
#include "issue29559.h"
|
||||
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
_seq "golang.org/x/mobile/bind/seq"
|
||||
"issue29559"
|
||||
)
|
||||
|
||||
// suppress the error if seq ends up unused
|
||||
var _ = _seq.FromRefNum
|
||||
|
||||
//export proxyissue29559__TakesAString
|
||||
func proxyissue29559__TakesAString(param_s C.nstring) {
|
||||
_param_s := decodeString(param_s)
|
||||
issue29559.TakesAString(_param_s)
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
// JNI functions for the Go <=> Java bridge.
|
||||
// gobind -lang=java issue29559
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#include <android/log.h>
|
||||
#include <stdint.h>
|
||||
#include "seq.h"
|
||||
#include "_cgo_export.h"
|
||||
#include "issue29559.h"
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_issue29559_Issue29559__1init(JNIEnv *env, jclass _unused) {
|
||||
jclass clazz;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_issue29559_Issue29559_takesAString(JNIEnv* env, jclass _clazz, jstring s) {
|
||||
nstring _s = go_seq_from_java_string(env, s);
|
||||
proxyissue29559__TakesAString(_s);
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
// Java class issue29559.Issue29559 is a proxy for talking to a Go program.
|
||||
// gobind -lang=java issue29559
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
package issue29559;
|
||||
|
||||
import go.Seq;
|
||||
|
||||
public abstract class Issue29559 {
|
||||
static {
|
||||
Seq.touch(); // for loading the native library
|
||||
_init();
|
||||
}
|
||||
|
||||
private Issue29559() {} // uninstantiable
|
||||
|
||||
// touch is called from other bound packages to initialize this package
|
||||
public static void touch() {}
|
||||
|
||||
private static native void _init();
|
||||
|
||||
|
||||
|
||||
public static native void takesAString(String s);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// JNI function headers for the Go <=> Java bridge.
|
||||
// gobind -lang=java issue29559
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Issue29559_H__
|
||||
#define __Issue29559_H__
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#endif
|
|
@ -0,0 +1,11 @@
|
|||
// Objective-C API for talking to issue29559 Go package.
|
||||
// gobind -lang=objc issue29559
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __GO_issue29559_H__
|
||||
#define __GO_issue29559_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <objc/objc.h>
|
||||
#endif
|
|
@ -0,0 +1,15 @@
|
|||
// Objective-C API for talking to issue29559 Go package.
|
||||
// gobind -lang=objc issue29559
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Issue29559_H__
|
||||
#define __Issue29559_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
FOUNDATION_EXPORT void Issue29559TakesAString(NSString* s);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,19 @@
|
|||
// Objective-C API for talking to issue29559 Go package.
|
||||
// gobind -lang=objc issue29559
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
#include "seq.h"
|
||||
#include "_cgo_export.h"
|
||||
#include "Issue29559.objc.h"
|
||||
|
||||
|
||||
void Issue29559TakesAString(NSString* s) {
|
||||
nstring _s = go_seq_from_objc_string(s);
|
||||
proxyissue29559__TakesAString(_s);
|
||||
}
|
||||
|
||||
__attribute__((constructor)) static void init() {
|
||||
init_seq();
|
||||
}
|
Loading…
Reference in New Issue