Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Unified Diff: lib/src/codegen/js_codegen.dart

Issue 955513008: cleans up sdk patching so we no longer have unresolved names (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/codegen/expect/_foreign_helper/_foreign_helper.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | test/codegen/expect/_foreign_helper/_foreign_helper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698