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 10 matching lines...) Expand all Loading... |
21 import com.google.dart.compiler.ast.LibraryNode; | 21 import com.google.dart.compiler.ast.LibraryNode; |
22 import com.google.dart.compiler.ast.LibraryUnit; | 22 import com.google.dart.compiler.ast.LibraryUnit; |
23 import com.google.dart.compiler.ast.Modifiers; | 23 import com.google.dart.compiler.ast.Modifiers; |
24 import com.google.dart.compiler.common.SourceInfo; | 24 import com.google.dart.compiler.common.SourceInfo; |
25 import com.google.dart.compiler.metrics.CompilerMetrics; | 25 import com.google.dart.compiler.metrics.CompilerMetrics; |
26 import com.google.dart.compiler.metrics.DartEventType; | 26 import com.google.dart.compiler.metrics.DartEventType; |
27 import com.google.dart.compiler.metrics.JvmMetrics; | 27 import com.google.dart.compiler.metrics.JvmMetrics; |
28 import com.google.dart.compiler.metrics.Tracer; | 28 import com.google.dart.compiler.metrics.Tracer; |
29 import com.google.dart.compiler.metrics.Tracer.TraceEvent; | 29 import com.google.dart.compiler.metrics.Tracer.TraceEvent; |
30 import com.google.dart.compiler.parser.DartParser; | 30 import com.google.dart.compiler.parser.DartParser; |
31 import com.google.dart.compiler.parser.DartScannerParserContext; | |
32 import com.google.dart.compiler.resolver.CompileTimeConstantAnalyzer; | 31 import com.google.dart.compiler.resolver.CompileTimeConstantAnalyzer; |
33 import com.google.dart.compiler.resolver.CompileTimeConstantResolver; | 32 import com.google.dart.compiler.resolver.CompileTimeConstantResolver; |
34 import com.google.dart.compiler.resolver.CoreTypeProvider; | 33 import com.google.dart.compiler.resolver.CoreTypeProvider; |
35 import com.google.dart.compiler.resolver.CoreTypeProviderImplementation; | 34 import com.google.dart.compiler.resolver.CoreTypeProviderImplementation; |
36 import com.google.dart.compiler.resolver.Element; | 35 import com.google.dart.compiler.resolver.Element; |
37 import com.google.dart.compiler.resolver.ElementKind; | 36 import com.google.dart.compiler.resolver.ElementKind; |
38 import com.google.dart.compiler.resolver.Elements; | 37 import com.google.dart.compiler.resolver.Elements; |
39 import com.google.dart.compiler.resolver.LibraryElement; | 38 import com.google.dart.compiler.resolver.LibraryElement; |
40 import com.google.dart.compiler.resolver.MemberBuilder; | 39 import com.google.dart.compiler.resolver.MemberBuilder; |
41 import com.google.dart.compiler.resolver.MethodElement; | 40 import com.google.dart.compiler.resolver.MethodElement; |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 failed = false; | 836 failed = false; |
838 } finally { | 837 } finally { |
839 Closeables.close(r, failed); | 838 Closeables.close(r, failed); |
840 } | 839 } |
841 | 840 |
842 // auto-magically define "assert" function | 841 // auto-magically define "assert" function |
843 if (dartSrc.getUri().toString().equals("dart://core/runtime/object.dart"
)) { | 842 if (dartSrc.getUri().toString().equals("dart://core/runtime/object.dart"
)) { |
844 srcCode += "\nvoid assert(x) {}"; | 843 srcCode += "\nvoid assert(x) {}"; |
845 } | 844 } |
846 | 845 |
847 DartScannerParserContext parserContext = | 846 DartParser parser = new DartParser(dartSrc, srcCode, diet, libraryPrefix
es, context, |
848 new DartScannerParserContext(dartSrc, srcCode, context, context.getC
ompilerMetrics()); | 847 context.getCompilerMetrics()); |
849 DartParser parser = new DartParser(parserContext, libraryPrefixes, diet)
; | 848 DartUnit unit = parser.parseUnit(); |
850 DartUnit unit = parser.parseUnit(dartSrc); | |
851 if (compilerMetrics != null) { | 849 if (compilerMetrics != null) { |
852 compilerMetrics.addParseTimeNano(CompilerMetrics.getThreadTime() - par
seStart); | 850 compilerMetrics.addParseTimeNano(CompilerMetrics.getThreadTime() - par
seStart); |
853 } | 851 } |
854 | 852 |
855 if (!config.resolveDespiteParseErrors() && context.getErrorCount() > 0)
{ | 853 if (!config.resolveDespiteParseErrors() && context.getErrorCount() > 0)
{ |
856 // We don't return this unit, so no more processing expected for it. | 854 // We don't return this unit, so no more processing expected for it. |
857 context.unitCompiled(unit); | 855 context.unitCompiled(unit); |
858 return null; | 856 return null; |
859 } | 857 } |
860 return unit; | 858 return unit; |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 return unit; | 1313 return unit; |
1316 } | 1314 } |
1317 } | 1315 } |
1318 return null; | 1316 return null; |
1319 } | 1317 } |
1320 | 1318 |
1321 public static LibraryUnit getCoreLib(LibraryUnit libraryUnit) { | 1319 public static LibraryUnit getCoreLib(LibraryUnit libraryUnit) { |
1322 return findLibrary(libraryUnit, "dart:core", new HashSet<LibraryElement>()); | 1320 return findLibrary(libraryUnit, "dart:core", new HashSet<LibraryElement>()); |
1323 } | 1321 } |
1324 } | 1322 } |
OLD | NEW |