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

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

Issue 1421003004: Add CoreClasses (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comment. 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 part of js_backend; 5 part of js_backend;
6 6
7 /** 7 /**
8 * Categorizes `noSuchMethod` implementations. 8 * Categorizes `noSuchMethod` implementations.
9 * 9 *
10 * If user code includes `noSuchMethod` implementations, type inference is 10 * If user code includes `noSuchMethod` implementations, type inference is
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 throwingImpls.add(element); 160 throwingImpls.add(element);
161 return NsmCategory.THROWING; 161 return NsmCategory.THROWING;
162 } else { 162 } else {
163 otherImpls.add(element); 163 otherImpls.add(element);
164 return NsmCategory.OTHER; 164 return NsmCategory.OTHER;
165 } 165 }
166 } 166 }
167 167
168 bool _isDefaultNoSuchMethodImplementation(FunctionElement element) { 168 bool _isDefaultNoSuchMethodImplementation(FunctionElement element) {
169 ClassElement classElement = element.enclosingClass; 169 ClassElement classElement = element.enclosingClass;
170 return classElement == _compiler.objectClass 170 return classElement == _compiler.coreClasses.objectClass
171 || classElement == _backend.jsInterceptorClass 171 || classElement == _backend.jsInterceptorClass
172 || classElement == _backend.jsNullClass; 172 || classElement == _backend.jsNullClass;
173 } 173 }
174 174
175 bool _hasForwardingSyntax(FunctionElement element) { 175 bool _hasForwardingSyntax(FunctionElement element) {
176 // At this point we know that this is signature-compatible with 176 // At this point we know that this is signature-compatible with
177 // Object.noSuchMethod, but it may have more than one argument as long as 177 // Object.noSuchMethod, but it may have more than one argument as long as
178 // it only has one required argument. 178 // it only has one required argument.
179 String param = element.parameters.first.name; 179 String param = element.parameters.first.name;
180 Statement body = element.node.body; 180 Statement body = element.node.body;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 if (body.statements.nodes.head is ExpressionStatement) { 218 if (body.statements.nodes.head is ExpressionStatement) {
219 ExpressionStatement stmt = body.statements.nodes.head; 219 ExpressionStatement stmt = body.statements.nodes.head;
220 return stmt.expression is Throw; 220 return stmt.expression is Throw;
221 } 221 }
222 } 222 }
223 return false; 223 return false;
224 } 224 }
225 } 225 }
226 226
227 enum NsmCategory { DEFAULT, THROWING, OTHER } 227 enum NsmCategory { DEFAULT, THROWING, OTHER }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/namer.dart ('k') | pkg/compiler/lib/src/js_backend/runtime_types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698