| Index: lib/src/codegen/js_codegen.dart
|
| diff --git a/lib/src/codegen/js_codegen.dart b/lib/src/codegen/js_codegen.dart
|
| index aa3bb2c53edd7c6b2d95275c59dedf8181b045c0..aeec324d59d20405ff936b7272c586e26187449f 100644
|
| --- a/lib/src/codegen/js_codegen.dart
|
| +++ b/lib/src/codegen/js_codegen.dart
|
| @@ -324,7 +324,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
|
|
|
| JS.Method _emitConstructor(ConstructorDeclaration node, String className,
|
| List<FieldDeclaration> fields) {
|
| - if (node.externalKeyword != null) return null;
|
| + if (_externalOrNative(node)) return null;
|
|
|
| var name = _constructorName(className, node.name);
|
|
|
| @@ -540,7 +540,9 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
|
|
|
| @override
|
| JS.Method visitMethodDeclaration(MethodDeclaration node) {
|
| - if (node.isAbstract || node.externalKeyword != null) return null;
|
| + if (node.isAbstract || _externalOrNative(node)) {
|
| + return null;
|
| + }
|
|
|
| var params = _visit(node.parameters);
|
| if (params == null) params = [];
|
| @@ -556,7 +558,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
|
| JS.Statement visitFunctionDeclaration(FunctionDeclaration node) {
|
| assert(node.parent is CompilationUnit);
|
|
|
| - if (node.externalKeyword != null) return null;
|
| + if (_externalOrNative(node)) return null;
|
|
|
| if (node.isGetter || node.isSetter) {
|
| // Add these later so we can use getter/setter syntax.
|
| @@ -1600,6 +1602,12 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
|
| return name;
|
| }
|
|
|
| + bool _externalOrNative(node) =>
|
| + node.externalKeyword != null || _functionBody(node) is NativeFunctionBody;
|
| +
|
| + FunctionBody _functionBody(node) =>
|
| + node is FunctionDeclaration ? node.functionExpression.body : node.body;
|
| +
|
| String _maybeBindThis(node) {
|
| if (currentClass == null) return '';
|
| var visitor = _BindThisVisitor._instance;
|
|
|