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

Side by Side Diff: pkg/compiler/lib/src/js_backend/js_interop_analysis.dart

Issue 1458313002: Fix for the js-interop crash Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Analysis to determine how to generate code for typed JavaScript interop. 5 /// Analysis to determine how to generate code for typed JavaScript interop.
6 library compiler.src.js_backend.js_interop_analysis; 6 library compiler.src.js_backend.js_interop_analysis;
7 7
8 import '../common/names.dart' show Identifiers; 8 import '../common/names.dart' show Identifiers;
9 import '../compiler.dart' show Compiler; 9 import '../compiler.dart' show Compiler;
10 import '../diagnostics/messages.dart' show MessageKind; 10 import '../diagnostics/messages.dart' show MessageKind;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 processJsInteropAnnotation(element); 113 processJsInteropAnnotation(element);
114 if (!backend.isJsInterop(element)) return; 114 if (!backend.isJsInterop(element)) return;
115 if (element is FunctionElement) { 115 if (element is FunctionElement) {
116 _checkFunctionParameters(element); 116 _checkFunctionParameters(element);
117 } 117 }
118 118
119 if (!element.isClass) return; 119 if (!element.isClass) return;
120 120
121 ClassElement classElement = element; 121 ClassElement classElement = element;
122 122
123 // If we have no indication that the type was instantiated, we don't need
124 // to generate code for it. Note that anonymous types are abstract and
125 // contain only a factory constructor, so they are marked in the world
126 // as being implemented rather than being instantiated.
127 if (!backend.compiler.world.isImplemented(classElement)) return;
128
123 if (!classElement 129 if (!classElement
124 .implementsInterface(helpers.jsJavaScriptObjectClass)) { 130 .implementsInterface(helpers.jsJavaScriptObjectClass)) {
125 backend.reporter.reportErrorMessage(classElement, 131 backend.reporter.reportErrorMessage(classElement,
126 MessageKind.JS_INTEROP_CLASS_CANNOT_EXTEND_DART_CLASS, { 132 MessageKind.JS_INTEROP_CLASS_CANNOT_EXTEND_DART_CLASS, {
127 'cls': classElement.name, 133 'cls': classElement.name,
128 'superclass': classElement.superclass.name 134 'superclass': classElement.superclass.name
129 }); 135 });
130 } 136 }
131 137
132 classElement.forEachMember( 138 classElement.forEachMember(
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 var name = backend.namer.invocationName(selector); 190 var name = backend.namer.invocationName(selector);
185 statements.add(js.statement( 191 statements.add(js.statement(
186 'Function.prototype.# = function(#) { return this(#) }', 192 'Function.prototype.# = function(#) { return this(#) }',
187 [name, parameters, parameters])); 193 [name, parameters, parameters]));
188 } 194 }
189 }); 195 });
190 }); 196 });
191 return new jsAst.Block(statements); 197 return new jsAst.Block(statements);
192 } 198 }
193 } 199 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/builder.dart » ('j') | pkg/compiler/lib/src/ssa/builder.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698