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

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

Issue 1172693003: Move computeType to TypedElement and TypeDeclarationElement. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 final Map<Element, ClassBuilder> cachedBuilders; 9 final Map<Element, ClassBuilder> cachedBuilders;
10 10
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 receiver = js('this'); 336 receiver = js('this');
337 arguments = argumentsBuffer.sublist(0, 337 arguments = argumentsBuffer.sublist(0,
338 indexOfLastOptionalArgumentInParameters + 1); 338 indexOfLastOptionalArgumentInParameters + 1);
339 } 339 }
340 statements.add( 340 statements.add(
341 js.statement('return #.#(#)', [receiver, target, arguments])); 341 js.statement('return #.#(#)', [receiver, target, arguments]));
342 342
343 return statements; 343 return statements;
344 } 344 }
345 345
346 bool isSupertypeOfNativeClass(Element element) { 346 bool isSupertypeOfNativeClass(ClassElement element) {
347 if (element.isTypeVariable) {
348 compiler.internalError(element, "Is check for type variable.");
349 return false;
350 }
351 if (element.computeType(compiler).unalias(compiler) is FunctionType) {
352 // The element type is a function type either directly or through
353 // typedef(s).
354 return false;
355 }
356
357 if (!element.isClass) {
358 compiler.internalError(element, "Is check does not handle element.");
359 return false;
360 }
361
362 if (backend.classesMixedIntoInterceptedClasses.contains(element)) { 347 if (backend.classesMixedIntoInterceptedClasses.contains(element)) {
363 return true; 348 return true;
364 } 349 }
365 350
366 return subtypes[element] != null; 351 return subtypes[element] != null;
367 } 352 }
368 353
369 bool requiresNativeIsCheck(Element element) { 354 bool requiresNativeIsCheck(Element element) {
370 // TODO(sra): Remove this function. It determines if a native type may 355 // TODO(sra): Remove this function. It determines if a native type may
371 // satisfy a check against [element], in which case an interceptor must be 356 // satisfy a check against [element], in which case an interceptor must be
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 } 449 }
465 ''', {'info': infoAccess, 450 ''', {'info': infoAccess,
466 'constructor': constructorAccess, 451 'constructor': constructorAccess,
467 'subclassRead': subclassRead, 452 'subclassRead': subclassRead,
468 'interceptorsByTagAccess': interceptorsByTagAccess, 453 'interceptorsByTagAccess': interceptorsByTagAccess,
469 'leafTagsAccess': leafTagsAccess, 454 'leafTagsAccess': leafTagsAccess,
470 'nativeSuperclassTagName': embeddedNames.NATIVE_SUPERCLASS_TAG_NAME, 455 'nativeSuperclassTagName': embeddedNames.NATIVE_SUPERCLASS_TAG_NAME,
471 'allowNativesSubclassing': true}); 456 'allowNativesSubclassing': true});
472 } 457 }
473 } 458 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/js_emitter.dart ('k') | pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698