| Index: pkg/compiler/lib/src/js_backend/js_interop_analysis.dart
|
| diff --git a/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart b/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart
|
| index 1ba5398e90ba9a382c48c6910a2b31be58e3bdd7..2798ac37c31e97ccff0f1314039a1832f1cf78a4 100644
|
| --- a/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart
|
| +++ b/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart
|
| @@ -62,16 +62,16 @@ class JsInteropAnalysis {
|
|
|
| void processJsInteropAnnotation(Element e) {
|
| for (MetadataAnnotation annotation in e.implementation.metadata) {
|
| - ConstantValue constant = backend.compiler.constants.getConstantValue(
|
| - annotation.constant);
|
| + ConstantValue constant =
|
| + backend.compiler.constants.getConstantValue(annotation.constant);
|
| if (constant == null || constant is! ConstructedConstantValue) continue;
|
| ConstructedConstantValue constructedConstant = constant;
|
| if (constructedConstant.type.element == helpers.jsAnnotationClass) {
|
| ConstantValue value = constructedConstant.fields[nameField];
|
| if (value.isString) {
|
| StringConstantValue stringValue = value;
|
| - backend.nativeData.setJsInteropName(
|
| - e, stringValue.primitiveValue.slowToString());
|
| + backend.nativeData
|
| + .setJsInteropName(e, stringValue.primitiveValue.slowToString());
|
| } else {
|
| // TODO(jacobr): report a warning if the value is not a String.
|
| backend.nativeData.setJsInteropName(e, '');
|
| @@ -85,10 +85,10 @@ class JsInteropAnalysis {
|
| bool hasAnonymousAnnotation(Element element) {
|
| if (backend.helpers.jsAnonymousClass == null) return false;
|
| return element.metadata.any((MetadataAnnotation annotation) {
|
| - ConstantValue constant = backend.compiler.constants.getConstantValue(
|
| - annotation.constant);
|
| - if (constant == null ||
|
| - constant is! ConstructedConstantValue) return false;
|
| + ConstantValue constant =
|
| + backend.compiler.constants.getConstantValue(annotation.constant);
|
| + if (constant == null || constant is! ConstructedConstantValue)
|
| + return false;
|
| ConstructedConstantValue constructedConstant = constant;
|
| return constructedConstant.type.element ==
|
| backend.helpers.jsAnonymousClass;
|
| @@ -98,10 +98,10 @@ class JsInteropAnalysis {
|
| void _checkFunctionParameters(FunctionElement fn) {
|
| if (fn.hasFunctionSignature &&
|
| fn.functionSignature.optionalParametersAreNamed) {
|
| - backend.reporter.reportErrorMessage(fn,
|
| - MessageKind.JS_INTEROP_METHOD_WITH_NAMED_ARGUMENTS, {
|
| - 'method': fn.name
|
| - });
|
| + backend.reporter.reportErrorMessage(
|
| + fn,
|
| + MessageKind.JS_INTEROP_METHOD_WITH_NAMED_ARGUMENTS,
|
| + {'method': fn.name});
|
| }
|
| }
|
|
|
| @@ -122,8 +122,7 @@ class JsInteropAnalysis {
|
| // when all of jsinterop types are unreachable from main.
|
| if (!backend.compiler.world.isImplemented(classElement)) return;
|
|
|
| - if (!classElement
|
| - .implementsInterface(helpers.jsJavaScriptObjectClass)) {
|
| + if (!classElement.implementsInterface(helpers.jsJavaScriptObjectClass)) {
|
| backend.reporter.reportErrorMessage(classElement,
|
| MessageKind.JS_INTEROP_CLASS_CANNOT_EXTEND_DART_CLASS, {
|
| 'cls': classElement.name,
|
| @@ -131,15 +130,16 @@ class JsInteropAnalysis {
|
| });
|
| }
|
|
|
| - classElement.forEachMember(
|
| - (ClassElement classElement, Element member) {
|
| + classElement.forEachMember((ClassElement classElement, Element member) {
|
| processJsInteropAnnotation(member);
|
|
|
| if (!member.isSynthesized &&
|
| backend.isJsInterop(classElement) &&
|
| member is FunctionElement) {
|
| FunctionElement fn = member;
|
| - if (!fn.isExternal && !fn.isAbstract && !fn.isConstructor &&
|
| + if (!fn.isExternal &&
|
| + !fn.isAbstract &&
|
| + !fn.isConstructor &&
|
| !fn.isStatic) {
|
| backend.reporter.reportErrorMessage(
|
| fn,
|
| @@ -148,16 +148,14 @@ class JsInteropAnalysis {
|
| }
|
|
|
| if (fn.isFactoryConstructor && hasAnonymousAnnotation(classElement)) {
|
| - fn.functionSignature.orderedForEachParameter(
|
| - (ParameterElement parameter) {
|
| - if (!parameter.isNamed) {
|
| - backend.reporter.reportErrorMessage(parameter,
|
| + fn.functionSignature
|
| + .orderedForEachParameter((ParameterElement parameter) {
|
| + if (!parameter.isNamed) {
|
| + backend.reporter.reportErrorMessage(
|
| + parameter,
|
| MessageKind
|
| .JS_OBJECT_LITERAL_CONSTRUCTOR_WITH_POSITIONAL_ARGUMENTS,
|
| - {
|
| - 'parameter': parameter.name,
|
| - 'cls': classElement.name
|
| - });
|
| + {'parameter': parameter.name, 'cls': classElement.name});
|
| }
|
| });
|
| } else {
|
|
|