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

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

Issue 11416144: Produce run-time error when type parameters are accessed from static context. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed dart2dart unchcked tests. Created 8 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
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 part of js_backend; 5 part of js_backend;
6 6
7 /** 7 /**
8 * Assigns JavaScript identifiers to Dart variables, class-names and members. 8 * Assigns JavaScript identifiers to Dart variables, class-names and members.
9 */ 9 */
10 class Namer { 10 class Namer {
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 // The name is not guaranteed to be unique. 375 // The name is not guaranteed to be unique.
376 return safeName(guess); 376 return safeName(guess);
377 } 377 }
378 if (kind == ElementKind.GENERATIVE_CONSTRUCTOR || 378 if (kind == ElementKind.GENERATIVE_CONSTRUCTOR ||
379 kind == ElementKind.FUNCTION || 379 kind == ElementKind.FUNCTION ||
380 kind == ElementKind.CLASS || 380 kind == ElementKind.CLASS ||
381 kind == ElementKind.FIELD || 381 kind == ElementKind.FIELD ||
382 kind == ElementKind.GETTER || 382 kind == ElementKind.GETTER ||
383 kind == ElementKind.SETTER || 383 kind == ElementKind.SETTER ||
384 kind == ElementKind.TYPEDEF || 384 kind == ElementKind.TYPEDEF ||
385 kind == ElementKind.LIBRARY) { 385 kind == ElementKind.LIBRARY ||
386 kind == ElementKind.MALFORMED_TYPE) {
386 bool isNative = false; 387 bool isNative = false;
387 if (identical(kind, ElementKind.CLASS)) { 388 if (identical(kind, ElementKind.CLASS)) {
388 ClassElement class_elt = element; 389 ClassElement class_elt = element;
389 isNative = class_elt.isNative(); 390 isNative = class_elt.isNative();
390 } 391 }
391 if (Elements.isInstanceField(element)) { 392 if (Elements.isInstanceField(element)) {
392 isNative = element.isNative(); 393 isNative = element.isNative();
393 } 394 }
394 String result = isNative ? guess : getFreshName(guess, usedGlobalNames); 395 String result = isNative ? guess : getFreshName(guess, usedGlobalNames);
395 globals[element] = result; 396 globals[element] = result;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 } 433 }
433 434
434 String safeName(String name) { 435 String safeName(String name) {
435 if (jsReserved.contains(name) || name.startsWith('\$')) { 436 if (jsReserved.contains(name) || name.startsWith('\$')) {
436 name = "\$$name"; 437 name = "\$$name";
437 assert(!jsReserved.contains(name)); 438 assert(!jsReserved.contains(name));
438 } 439 }
439 return name; 440 return name;
440 } 441 }
441 } 442 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698