Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 * Should be called exactly once to setup singleton world. | 9 * Should be called exactly once to setup singleton world. |
| 10 * Can use world.reset() to reinitialize. | 10 * Can use world.reset() to reinitialize. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 | 85 |
| 86 // Special types to Dart. | 86 // Special types to Dart. |
| 87 Type varType; | 87 Type varType; |
| 88 // TODO(jimhug): Is this ever not === varType? | 88 // TODO(jimhug): Is this ever not === varType? |
| 89 Type dynamicType; | 89 Type dynamicType; |
| 90 | 90 |
| 91 Type voidType; | 91 Type voidType; |
| 92 | 92 |
| 93 Type objectType; | 93 Type objectType; |
| 94 Type numType; | 94 Type numType; |
| 95 Type intType; | |
|
jimhug
2011/11/07 16:41:26
Darn. I was hoping we could pretend these just di
| |
| 96 Type doubleType; | |
| 95 Type boolType; | 97 Type boolType; |
| 96 Type stringType; | 98 Type stringType; |
| 97 Type listType; | 99 Type listType; |
| 98 Type mapType; | 100 Type mapType; |
| 99 Type functionType; | 101 Type functionType; |
| 100 | 102 |
| 101 World(this.files) | 103 World(this.files) |
| 102 : libraries = {}, _todo = [], _members = {}, _topNames = {}, | 104 : libraries = {}, _todo = [], _members = {}, _topNames = {}, |
| 103 // TODO(jmesserly): these two types don't actually back our Date and | 105 // TODO(jmesserly): these two types don't actually back our Date and |
| 104 // RegExp yet, so we need to add them manually. | 106 // RegExp yet, so we need to add them manually. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 118 corelib = new Library(readFile('dart:core')); | 120 corelib = new Library(readFile('dart:core')); |
| 119 libraries['dart:core'] = corelib; | 121 libraries['dart:core'] = corelib; |
| 120 _todo.add(corelib); | 122 _todo.add(corelib); |
| 121 | 123 |
| 122 voidType = _addToCoreLib('void', false); | 124 voidType = _addToCoreLib('void', false); |
| 123 dynamicType = _addToCoreLib('Dynamic', false); | 125 dynamicType = _addToCoreLib('Dynamic', false); |
| 124 varType = dynamicType; | 126 varType = dynamicType; |
| 125 | 127 |
| 126 objectType = _addToCoreLib('Object', true); | 128 objectType = _addToCoreLib('Object', true); |
| 127 numType = _addToCoreLib('num', false); | 129 numType = _addToCoreLib('num', false); |
| 130 intType = _addToCoreLib('int', false); | |
| 131 doubleType = _addToCoreLib('double', false); | |
| 128 boolType = _addToCoreLib('bool', false); | 132 boolType = _addToCoreLib('bool', false); |
| 129 stringType = _addToCoreLib('String', false); | 133 stringType = _addToCoreLib('String', false); |
| 130 listType = _addToCoreLib('List', false); | 134 listType = _addToCoreLib('List', false); |
| 131 mapType = _addToCoreLib('Map', false); | 135 mapType = _addToCoreLib('Map', false); |
| 132 functionType = _addToCoreLib('Function', false); | 136 functionType = _addToCoreLib('Function', false); |
| 133 } | 137 } |
| 134 | 138 |
| 135 _addMember(Member member) { | 139 _addMember(Member member) { |
| 136 // Private members are only visible in their own library. | 140 // Private members are only visible in their own library. |
| 137 assert(!member.isPrivate); | 141 assert(!member.isPrivate); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 425 | 429 |
| 426 withTiming(String name, f()) { | 430 withTiming(String name, f()) { |
| 427 final sw = new StopWatch(); | 431 final sw = new StopWatch(); |
| 428 sw.start(); | 432 sw.start(); |
| 429 var result = f(); | 433 var result = f(); |
| 430 sw.stop(); | 434 sw.stop(); |
| 431 info('$name in ${sw.elapsedInMs()}msec'); | 435 info('$name in ${sw.elapsedInMs()}msec'); |
| 432 return result; | 436 return result; |
| 433 } | 437 } |
| 434 } | 438 } |
| OLD | NEW |