| 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 package com.google.dart.compiler; | 5 package com.google.dart.compiler; |
| 6 | 6 |
| 7 import com.google.common.collect.Lists; | 7 import com.google.common.collect.Lists; |
| 8 import com.google.common.collect.Maps; | 8 import com.google.common.collect.Maps; |
| 9 import com.google.common.collect.Sets; | 9 import com.google.common.collect.Sets; |
| 10 import com.google.common.collect.Sets.SetView; | 10 import com.google.common.collect.Sets.SetView; |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 boolean failed = true; | 843 boolean failed = true; |
| 844 try { | 844 try { |
| 845 try { | 845 try { |
| 846 srcCode = CharStreams.toString(r); | 846 srcCode = CharStreams.toString(r); |
| 847 failed = false; | 847 failed = false; |
| 848 } finally { | 848 } finally { |
| 849 Closeables.close(r, failed); | 849 Closeables.close(r, failed); |
| 850 } | 850 } |
| 851 | 851 |
| 852 // auto-magically define "assert" function | 852 // auto-magically define "assert" function |
| 853 if (dartSrc.getUri().toString().equals("dart://core/runtime/object.dart"
)) { | 853 if (dartSrc.getUri().toString().equals("dart://core/object.dart")) { |
| 854 srcCode += "\nvoid assert(x) {}"; | 854 srcCode += "\nvoid assert(x) {}"; |
| 855 } | 855 } |
| 856 | 856 |
| 857 // inject "Type" type from 1.0 M1 specification | 857 // inject "Type" type from 1.0 M1 specification |
| 858 // remove once it will be added into SDK | 858 // remove once it will be added into SDK |
| 859 // http://code.google.com/p/dart/issues/detail?id=3368 | 859 // http://code.google.com/p/dart/issues/detail?id=3368 |
| 860 if (dartSrc.getUri().toString().equals("dart://core/runtime/object.dart"
)) { | 860 if (dartSrc.getUri().toString().equals("dart://core/object.dart")) { |
| 861 srcCode += "\nclass Type {}"; | 861 srcCode += "\nclass Type {}"; |
| 862 } | 862 } |
| 863 | 863 |
| 864 DartParser parser = new DartParser(dartSrc, srcCode, diet, libraryPrefix
es, context, | 864 DartParser parser = new DartParser(dartSrc, srcCode, diet, libraryPrefix
es, context, |
| 865 context.getCompilerMetrics()); | 865 context.getCompilerMetrics()); |
| 866 DartUnit unit = parser.parseUnit(); | 866 DartUnit unit = parser.parseUnit(); |
| 867 if (compilerMetrics != null) { | 867 if (compilerMetrics != null) { |
| 868 compilerMetrics.addParseTimeNano(CompilerMetrics.getThreadTime() - par
seStart); | 868 compilerMetrics.addParseTimeNano(CompilerMetrics.getThreadTime() - par
seStart); |
| 869 } | 869 } |
| 870 | 870 |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 return br.readLine(); | 1382 return br.readLine(); |
| 1383 } finally { | 1383 } finally { |
| 1384 br.close(); | 1384 br.close(); |
| 1385 } | 1385 } |
| 1386 } | 1386 } |
| 1387 } catch (Throwable e) { | 1387 } catch (Throwable e) { |
| 1388 } | 1388 } |
| 1389 return null; | 1389 return null; |
| 1390 } | 1390 } |
| 1391 } | 1391 } |
| OLD | NEW |