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

Side by Side Diff: lib/compiler/implementation/js_backend/namer.dart

Issue 10996039: Bring type variables into static scope, but produce compile-time error when they are used. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Produce warning and dynamic type error instead of compile-time error. Created 8 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 | Annotate | Revision Log
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 /** 5 /**
6 * Assigns JavaScript identifiers to Dart variables, class-names and members. 6 * Assigns JavaScript identifiers to Dart variables, class-names and members.
7 */ 7 */
8 class Namer { 8 class Namer {
9 final Compiler compiler; 9 final Compiler compiler;
10 10
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // The name is not guaranteed to be unique. 263 // The name is not guaranteed to be unique.
264 return guess; 264 return guess;
265 } 265 }
266 if (kind === ElementKind.GENERATIVE_CONSTRUCTOR || 266 if (kind === ElementKind.GENERATIVE_CONSTRUCTOR ||
267 kind === ElementKind.FUNCTION || 267 kind === ElementKind.FUNCTION ||
268 kind === ElementKind.CLASS || 268 kind === ElementKind.CLASS ||
269 kind === ElementKind.FIELD || 269 kind === ElementKind.FIELD ||
270 kind === ElementKind.GETTER || 270 kind === ElementKind.GETTER ||
271 kind === ElementKind.SETTER || 271 kind === ElementKind.SETTER ||
272 kind === ElementKind.TYPEDEF || 272 kind === ElementKind.TYPEDEF ||
273 kind === ElementKind.LIBRARY) { 273 kind === ElementKind.LIBRARY ||
274 kind === ElementKind.MALFORMED_TYPE) {
274 String result = getFreshGlobalName(guess); 275 String result = getFreshGlobalName(guess);
275 globals[element] = result; 276 globals[element] = result;
276 return result; 277 return result;
277 } 278 }
278 compiler.internalError('getName for unknown kind: ${element.kind}', 279 compiler.internalError('getName for unknown kind: ${element.kind}',
279 node: element.parseNode(compiler)); 280 node: element.parseNode(compiler));
280 } 281 }
281 } 282 }
282 283
283 String getLazyInitializerName(Element element) { 284 String getLazyInitializerName(Element element) {
(...skipping 27 matching lines...) Expand all
311 } 312 }
312 313
313 String safeName(String name) { 314 String safeName(String name) {
314 if (jsReserved.contains(name) || name.startsWith('\$')) { 315 if (jsReserved.contains(name) || name.startsWith('\$')) {
315 name = "\$$name"; 316 name = "\$$name";
316 assert(!jsReserved.contains(name)); 317 assert(!jsReserved.contains(name));
317 } 318 }
318 return name; 319 return name;
319 } 320 }
320 } 321 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698