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

Side by Side Diff: frog/world.dart

Issue 8985010: Move tests using frog 'native' extension from tests/language to frog/tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « frog/tests/frog/src/NativePropertyFrogTest.dart ('k') | tests/language/language.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 /** The one true [World]. */ 5 /** The one true [World]. */
6 World world; 6 World world;
7 7
8 /** 8 /**
9 * Experimental phase to enable await, only set when using the 9 * Experimental phase to enable await, only set when using the
10 * await/awaitc.dart entrypoint. 10 * await/awaitc.dart entrypoint.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 var mset = _members[member.name]; 155 var mset = _members[member.name];
156 if (mset == null) { 156 if (mset == null) {
157 mset = new MemberSet(member, isVar:true); 157 mset = new MemberSet(member, isVar:true);
158 _members[mset.name] = mset; 158 _members[mset.name] = mset;
159 } else { 159 } else {
160 mset.members.add(member); 160 mset.members.add(member);
161 } 161 }
162 } 162 }
163 163
164 _addTopName(Element named) { 164 _addTopName(Element named) {
165 // What makes this method so complicated is that it is incremental. It
166 // would me much simpler if the names could be added in priority order,
167 // e.g. native classes, library classes and finally user code.
168
169 if (named.isNative && named is Type) {
170 // Hidden native classes have two names: a native name that should be
171 // avoided since it might not actually be hidden, and a jsname that is
172 // used for class data, e.g. static members.
173 //
174 // Consider:
175 //
176 // #library('public');
177 // interface DOMWindow { ... }
178 // #library('impl');
179 // class DOMWindow implements public.DOMWindow native '*DOMWindow' { }
180 // #library('proxy');
181 // class DOMWindow implements public.DOMWindow { ... }
182 //
183 // The global name 'DOMWindow' is reserved for the native implementation,
184 // so the others all need to be renamed to avoid conflict.
185
186 Type namedType = named;
187 if (namedType.isHiddenNativeType) {
188 var nativeName = namedType.definition.nativeType.name;
189 var existing = _topNames[nativeName];
190 if (existing != null) {
191 if (existing.isNative) {
192 world.internalError('conflicting native names "${named.jsname}" '
193 + '(already defined in ${existing.span.locationText})',
194 named.span);
195 } else {
196 _addJavascriptTopName(existing); // Rename conflicting type.
197 }
198 }
199 _topNames[nativeName] = named;
200 if (nativeName == named.jsname) {
201 // class X native '*X' {} - need to rename the jsname.
202 _addJavascriptTopName(named);
203 return;
204 }
205 }
206 }
207
165 var existing = _topNames[named.jsname]; 208 var existing = _topNames[named.jsname];
166 if (existing != null) { 209 if (existing != null) {
167 info('mangling matching top level name "${named.jsname}" in ' 210 info('mangling matching top level name "${named.jsname}" in '
168 + 'both "${named.library.jsname}" and "${existing.library.jsname}"'); 211 + 'both "${named.library.jsname}" and "${existing.library.jsname}"');
169 212
170 if (named.isNative) { 213 if (named.isNative) {
171 // resolve conflicts in favor first of natives 214 // resolve conflicts in favor first of natives
172 if (existing.isNative) { 215 if (existing.isNative) {
173 world.internalError('conflicting native names "${named.jsname}" ' 216 world.internalError('conflicting native names "${named.jsname}" '
174 + '(already defined in ${existing.span.locationText})', 217 + '(already defined in ${existing.span.locationText})',
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 553
511 withTiming(String name, f()) { 554 withTiming(String name, f()) {
512 final sw = new Stopwatch(); 555 final sw = new Stopwatch();
513 sw.start(); 556 sw.start();
514 var result = f(); 557 var result = f();
515 sw.stop(); 558 sw.stop();
516 info('$name in ${sw.elapsedInMs()}msec'); 559 info('$name in ${sw.elapsedInMs()}msec');
517 return result; 560 return result;
518 } 561 }
519 } 562 }
OLDNEW
« no previous file with comments | « frog/tests/frog/src/NativePropertyFrogTest.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698