| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 compilerIsolate(port) { | 5 compilerIsolate(port) { |
| 6 Runner runner = new Runner(); | 6 Runner runner = new Runner(); |
| 7 runner.init(); | 7 runner.init(); |
| 8 | 8 |
| 9 port.receive((msg, replyTo) { | 9 port.receive((msg, replyTo) { |
| 10 replyTo.send(runner.update(msg)); | 10 replyTo.send(runner.update(msg)); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 Stopwatch sw = new Stopwatch()..start(); | 136 Stopwatch sw = new Stopwatch()..start(); |
| 137 | 137 |
| 138 LibraryElement e = compile(new LeapScript(codeText)); | 138 LibraryElement e = compile(new LeapScript(codeText)); |
| 139 | 139 |
| 140 void printFunction(FunctionElement fe, [String indentation = ""]) { | 140 void printFunction(FunctionElement fe, [String indentation = ""]) { |
| 141 var paramAcc = []; | 141 var paramAcc = []; |
| 142 | 142 |
| 143 FunctionType ft = fe.computeType(compiler); | 143 FunctionType ft = fe.computeType(compiler); |
| 144 | 144 |
| 145 sb.add("<div>${indentation}"); | 145 sb.write("<div>${indentation}"); |
| 146 ft.returnType.name.printOn(sb); | 146 ft.returnType.name.printOn(sb); |
| 147 sb.add(" "); | 147 sb.write(" "); |
| 148 fe.name.printOn(sb); | 148 fe.name.printOn(sb); |
| 149 sb.add("("); | 149 sb.write("("); |
| 150 ft.parameterTypes.printOn(sb, ", "); | 150 ft.parameterTypes.printOn(sb, ", "); |
| 151 sb.add(");</div>"); | 151 sb.write(");</div>"); |
| 152 | 152 |
| 153 } | 153 } |
| 154 | 154 |
| 155 void printField(FieldElement fe, [String indentation = ""]) { | 155 void printField(FieldElement fe, [String indentation = ""]) { |
| 156 sb.add("<div>${indentation}var "); | 156 sb.write("<div>${indentation}var "); |
| 157 fe.name.printOn(sb); | 157 fe.name.printOn(sb); |
| 158 sb.add(";</div>"); | 158 sb.write(";</div>"); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void printClass(ClassElement ce) { | 161 void printClass(ClassElement ce) { |
| 162 ce.parseNode(compiler); | 162 ce.parseNode(compiler); |
| 163 | 163 |
| 164 sb.add("<div>class "); | 164 sb.write("<div>class "); |
| 165 ce.name.printOn(sb); | 165 ce.name.printOn(sb); |
| 166 sb.add(" {"); | 166 sb.write(" {"); |
| 167 | 167 |
| 168 for (Element e in ce.members.reverse()) { | 168 for (Element e in ce.members.reverse()) { |
| 169 switch(e.kind) { | 169 switch(e.kind) { |
| 170 case ElementKind.FUNCTION: | 170 case ElementKind.FUNCTION: |
| 171 | 171 |
| 172 printFunction(e, " "); | 172 printFunction(e, " "); |
| 173 break; | 173 break; |
| 174 | 174 |
| 175 case ElementKind.FIELD: | 175 case ElementKind.FIELD: |
| 176 | 176 |
| 177 printField(e, " "); | 177 printField(e, " "); |
| 178 break; | 178 break; |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 sb.add("}</div>"); | 181 sb.write("}</div>"); |
| 182 } | 182 } |
| 183 | 183 |
| 184 for (Element c in e.topLevelElements.reverse()) { | 184 for (Element c in e.topLevelElements.reverse()) { |
| 185 switch (c.kind) { | 185 switch (c.kind) { |
| 186 case ElementKind.FUNCTION: | 186 case ElementKind.FUNCTION: |
| 187 printFunction (c); | 187 printFunction (c); |
| 188 break; | 188 break; |
| 189 | 189 |
| 190 case ElementKind.CLASS: | 190 case ElementKind.CLASS: |
| 191 printClass(c); | 191 printClass(c); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 mainApp = new LibraryElement(script); | 278 mainApp = new LibraryElement(script); |
| 279 | 279 |
| 280 universe.libraries.remove(script.uri.toString()); | 280 universe.libraries.remove(script.uri.toString()); |
| 281 Element element; | 281 Element element; |
| 282 withCurrentElement(mainApp, () { | 282 withCurrentElement(mainApp, () { |
| 283 scanner.scan(mainApp); | 283 scanner.scan(mainApp); |
| 284 }); | 284 }); |
| 285 return mainApp; | 285 return mainApp; |
| 286 } | 286 } |
| 287 } | 287 } |
| OLD | NEW |