)
Temporary method that we hope to remove at some point. This method should generally only be called by machine generated code.
Source
/**
* Temporary method that we hope to remove at some point. This method should
* generally only be called by machine generated code.
*/
void registerJsInterfaces(List<Type> classes) {
if (_finalized == true) {
throw 'JSInterop class registration already finalized';
}
for (Type type in classes) {
if (!_jsInterfaceTypes.add(type)) continue; // Already registered.
mirrors.ClassMirror typeMirror = mirrors.reflectType(type);
typeMirror.declarations.forEach((symbol, declaration) {
if (declaration is mirrors.MethodMirror ||
declaration is mirrors.VariableMirror && !declaration.isStatic) {
bool treatAsGetter = false;
bool treatAsSetter = false;
if (declaration is mirrors.VariableMirror) {
treatAsGetter = true;
if (!declaration.isConst && !declaration.isFinal) {
treatAsSetter = true;
}
} else {
if (declaration.isGetter) {
treatAsGetter = true;
} else if (declaration.isSetter) {
treatAsSetter = true;
} else if (!declaration.isConstructor) {
_allowedMethods
.putIfAbsent(symbol, () => new _DeclarationSet())
.add(declaration);
}
}
if (treatAsGetter) {
_allowedGetters
.putIfAbsent(symbol, () => new _DeclarationSet())
.add(declaration);
_allowedMethods
.putIfAbsent(symbol, () => new _DeclarationSet())
.add(declaration);
}
if (treatAsSetter) {
_allowedSetters
.putIfAbsent(symbol, () => new _DeclarationSet())
.add(declaration);
}
}
});
}
}