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

Side by Side Diff: dart/sdk/lib/_internal/lib/js_mirrors.dart

Issue 113193006: Handle dynamic as type argument. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r31967. Created 6 years, 11 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
« no previous file with comments | « no previous file | dart/tests/lib/lib.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dart._js_mirrors; 5 library dart._js_mirrors;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'dart:collection' show 9 import 'dart:collection' show
10 UnmodifiableListView; 10 UnmodifiableListView;
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 } 509 }
510 } 510 }
511 511
512 TypeMirror reflectType(Type key) { 512 TypeMirror reflectType(Type key) {
513 return reflectClassByMangledName(getMangledTypeName(key)); 513 return reflectClassByMangledName(getMangledTypeName(key));
514 } 514 }
515 515
516 TypeMirror reflectClassByMangledName(String mangledName) { 516 TypeMirror reflectClassByMangledName(String mangledName) {
517 String unmangledName = mangledGlobalNames[mangledName]; 517 String unmangledName = mangledGlobalNames[mangledName];
518 if (mangledName == 'dynamic') return JsMirrorSystem._dynamicType; 518 if (mangledName == 'dynamic') return JsMirrorSystem._dynamicType;
519 if (mangledName == 'void') return JsMirrorSystem._voidType;
519 if (unmangledName == null) unmangledName = mangledName; 520 if (unmangledName == null) unmangledName = mangledName;
520 return reflectClassByName(s(unmangledName), mangledName); 521 return reflectClassByName(s(unmangledName), mangledName);
521 } 522 }
522 523
523 var classMirrors; 524 var classMirrors;
524 525
525 TypeMirror reflectClassByName(Symbol symbol, String mangledName) { 526 TypeMirror reflectClassByName(Symbol symbol, String mangledName) {
526 if (classMirrors == null) classMirrors = JsCache.allocate(); 527 if (classMirrors == null) classMirrors = JsCache.allocate();
527 var mirror = JsCache.fetch(classMirrors, mangledName); 528 var mirror = JsCache.fetch(classMirrors, mangledName);
528 if (mirror != null) return mirror; 529 if (mirror != null) return mirror;
(...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after
2379 // [type] represents a type variable used as type argument for example 2380 // [type] represents a type variable used as type argument for example
2380 // the type argument of Bar: class Foo<T> extends Bar<T> {} 2381 // the type argument of Bar: class Foo<T> extends Bar<T> {}
2381 TypeMirror typeArgument = getTypeArgument(type); 2382 TypeMirror typeArgument = getTypeArgument(type);
2382 if (typeArgument is JsTypeVariableMirror) 2383 if (typeArgument is JsTypeVariableMirror)
2383 return typeArgument; 2384 return typeArgument;
2384 } 2385 }
2385 String substituteTypeVariable(int index) { 2386 String substituteTypeVariable(int index) {
2386 var typeArgument = getTypeArgument(index); 2387 var typeArgument = getTypeArgument(index);
2387 if (typeArgument is JsTypeVariableMirror) 2388 if (typeArgument is JsTypeVariableMirror)
2388 return '${typeArgument._metadataIndex}'; 2389 return '${typeArgument._metadataIndex}';
2389 assert(typeArgument is JsClassMirror || 2390 if (typeArgument is! JsClassMirror &&
2390 typeArgument is JsTypeBoundClassMirror); 2391 typeArgument is! JsTypeBoundClassMirror) {
2392 if (typeArgument == JsMirrorSystem._dynamicType) {
2393 return 'dynamic';
2394 } else if (typeArgument == JsMirrorSystem._voidType) {
2395 return 'void';
2396 } else {
2397 // TODO(ahe): This case shouldn't happen.
2398 return 'dynamic';
2399 }
2400 }
2391 return typeArgument._mangledName; 2401 return typeArgument._mangledName;
2392 } 2402 }
2393 representation = 2403 representation =
2394 runtimeTypeToString(type, onTypeVariable: substituteTypeVariable); 2404 runtimeTypeToString(type, onTypeVariable: substituteTypeVariable);
2395 } 2405 }
2396 if (representation != null) { 2406 if (representation != null) {
2397 return reflectClassByMangledName( 2407 return reflectClassByMangledName(
2398 getMangledTypeName(createRuntimeType(representation))); 2408 getMangledTypeName(createRuntimeType(representation)));
2399 } 2409 }
2400 return reflectClass(Function); 2410 return reflectClass(Function);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
2555 void operator []=(K key, V value) => _throw(); 2565 void operator []=(K key, V value) => _throw();
2556 2566
2557 V putIfAbsent(K key, V ifAbsent()) { _throw(); } 2567 V putIfAbsent(K key, V ifAbsent()) { _throw(); }
2558 2568
2559 void addAll(Map<K, V> other) => _throw(); 2569 void addAll(Map<K, V> other) => _throw();
2560 2570
2561 V remove(K key) { _throw(); } 2571 V remove(K key) { _throw(); }
2562 2572
2563 void clear() => _throw(); 2573 void clear() => _throw();
2564 } 2574 }
OLDNEW
« no previous file with comments | « no previous file | dart/tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698