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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/native_emitter.dart

Issue 1397053002: Introduce DartType.unaliased to avoid use of Resolution in the backend. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 class NativeEmitter { 7 class NativeEmitter {
8 8
9 // TODO(floitsch): the native-emitter should not know about ClassBuilders. 9 // TODO(floitsch): the native-emitter should not know about ClassBuilders.
10 final Map<Element, full_js_emitter.ClassBuilder> cachedBuilders; 10 final Map<Element, full_js_emitter.ClassBuilder> cachedBuilders;
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 FunctionSignature parameters = member.functionSignature; 261 FunctionSignature parameters = member.functionSignature;
262 Element converter = backend.findHelper('convertDartClosureToJS'); 262 Element converter = backend.findHelper('convertDartClosureToJS');
263 jsAst.Expression closureConverter = 263 jsAst.Expression closureConverter =
264 emitterTask.staticFunctionAccess(converter); 264 emitterTask.staticFunctionAccess(converter);
265 parameters.forEachParameter((ParameterElement parameter) { 265 parameters.forEachParameter((ParameterElement parameter) {
266 String name = parameter.name; 266 String name = parameter.name;
267 // If [name] is not in [stubParameters], then the parameter is an optional 267 // If [name] is not in [stubParameters], then the parameter is an optional
268 // parameter that was not provided for this stub. 268 // parameter that was not provided for this stub.
269 for (jsAst.Parameter stubParameter in stubParameters) { 269 for (jsAst.Parameter stubParameter in stubParameters) {
270 if (stubParameter.name == name) { 270 if (stubParameter.name == name) {
271 DartType type = parameter.type.unalias(compiler.resolution); 271 DartType type = parameter.type.unaliased;
272 if (type is FunctionType) { 272 if (type is FunctionType) {
273 // The parameter type is a function type either directly or through 273 // The parameter type is a function type either directly or through
274 // typedef(s). 274 // typedef(s).
275 FunctionType functionType = type; 275 FunctionType functionType = type;
276 int arity = functionType.computeArity(); 276 int arity = functionType.computeArity();
277 statements.add( 277 statements.add(
278 js.statement('# = #(#, $arity)', 278 js.statement('# = #(#, $arity)',
279 [name, closureConverter, name])); 279 [name, closureConverter, name]));
280 break; 280 break;
281 } 281 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 // used. We should also use an interceptor if the check can't be satisfied 343 // used. We should also use an interceptor if the check can't be satisfied
344 // by a native class in case we get a native instance that tries to spoof 344 // by a native class in case we get a native instance that tries to spoof
345 // the type info. i.e the criteria for whether or not to use an interceptor 345 // the type info. i.e the criteria for whether or not to use an interceptor
346 // is whether the receiver can be native, not the type of the test. 346 // is whether the receiver can be native, not the type of the test.
347 if (element == null || !element.isClass) return false; 347 if (element == null || !element.isClass) return false;
348 ClassElement cls = element; 348 ClassElement cls = element;
349 if (Elements.isNativeOrExtendsNative(cls)) return true; 349 if (Elements.isNativeOrExtendsNative(cls)) return true;
350 return isSupertypeOfNativeClass(element); 350 return isSupertypeOfNativeClass(element);
351 } 351 }
352 } 352 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/runtime_types.dart ('k') | pkg/compiler/lib/src/native/behavior.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698