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

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

Issue 2595493002: Merge CoreTypes and CoreClasses into CommonElements. (Closed)
Patch Set: Updated cf. comment Created 3 years, 12 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 // TODO(floitsch): the native-emitter should not know about ClassBuilders. 8 // TODO(floitsch): the native-emitter should not know about ClassBuilders.
9 final Map<Element, full_js_emitter.ClassBuilder> cachedBuilders; 9 final Map<Element, full_js_emitter.ClassBuilder> cachedBuilders;
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // Compute a pre-order traversal of the subclass forest. We actually want a 76 // Compute a pre-order traversal of the subclass forest. We actually want a
77 // post-order traversal but it is easier to compute the pre-order and use it 77 // post-order traversal but it is easier to compute the pre-order and use it
78 // in reverse. 78 // in reverse.
79 List<Class> preOrder = <Class>[]; 79 List<Class> preOrder = <Class>[];
80 Set<Class> seen = new Set<Class>(); 80 Set<Class> seen = new Set<Class>();
81 81
82 Class objectClass = null; 82 Class objectClass = null;
83 Class jsInterceptorClass = null; 83 Class jsInterceptorClass = null;
84 84
85 void walk(Class cls) { 85 void walk(Class cls) {
86 if (cls.element == compiler.coreClasses.objectClass) { 86 if (cls.element == compiler.commonElements.objectClass) {
87 objectClass = cls; 87 objectClass = cls;
88 return; 88 return;
89 } 89 }
90 if (cls.element == helpers.jsInterceptorClass) { 90 if (cls.element == helpers.jsInterceptorClass) {
91 jsInterceptorClass = cls; 91 jsInterceptorClass = cls;
92 return; 92 return;
93 } 93 }
94 if (seen.contains(cls)) return; 94 if (seen.contains(cls)) return;
95 seen.add(cls); 95 seen.add(cls);
96 walk(cls.superclass); 96 walk(cls.superclass);
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 // used. We should also use an interceptor if the check can't be satisfied 350 // used. We should also use an interceptor if the check can't be satisfied
351 // by a native class in case we get a native instance that tries to spoof 351 // by a native class in case we get a native instance that tries to spoof
352 // the type info. i.e the criteria for whether or not to use an interceptor 352 // the type info. i.e the criteria for whether or not to use an interceptor
353 // is whether the receiver can be native, not the type of the test. 353 // is whether the receiver can be native, not the type of the test.
354 if (element == null || !element.isClass) return false; 354 if (element == null || !element.isClass) return false;
355 ClassElement cls = element; 355 ClassElement cls = element;
356 if (backend.isNativeOrExtendsNative(cls)) return true; 356 if (backend.isNativeOrExtendsNative(cls)) return true;
357 return isSupertypeOfNativeClass(element); 357 return isSupertypeOfNativeClass(element);
358 } 358 }
359 } 359 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698