| 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 package com.google.dart.compiler.backend.js; | 5 package com.google.dart.compiler.backend.js; |
| 6 | 6 |
| 7 import com.google.common.base.Strings; | 7 import com.google.common.base.Strings; |
| 8 import com.google.dart.compiler.CommandLineOptions.CompilerOptions; | 8 import com.google.dart.compiler.CommandLineOptions.CompilerOptions; |
| 9 import com.google.dart.compiler.CompilerConfiguration; | 9 import com.google.dart.compiler.CompilerConfiguration; |
| 10 import com.google.dart.compiler.CompilerTestCase; | 10 import com.google.dart.compiler.CompilerTestCase; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 } | 46 } |
| 47 | 47 |
| 48 protected String compileSingleUnit(final String filePath, final String part) t
hrows IOException { | 48 protected String compileSingleUnit(final String filePath, final String part) t
hrows IOException { |
| 49 URL url = inputUrlFor(getClass(), filePath + ".dart"); | 49 URL url = inputUrlFor(getClass(), filePath + ".dart"); |
| 50 String source = readUrl(url); | 50 String source = readUrl(url); |
| 51 MockLibrarySource lib = new MockLibrarySource(); | 51 MockLibrarySource lib = new MockLibrarySource(); |
| 52 DartSourceTest src = new DartSourceTest(filePath, source, lib); | 52 DartSourceTest src = new DartSourceTest(filePath, source, lib); |
| 53 lib.addSource(src); | 53 lib.addSource(src); |
| 54 CompilerOptions options = new CompilerOptions(); | 54 CompilerOptions options = new CompilerOptions(); |
| 55 CompilerConfiguration config = new DefaultCompilerConfiguration(this.getBack
end(), options); | 55 CompilerConfiguration config = new DefaultCompilerConfiguration(this.getBack
end(), options); |
| 56 DartCompilerListener listener = new DartCompilerListenerTest(src.getName()); | 56 DartCompilerListenerTest listener = new DartCompilerListenerTest(src.getName
()); |
| 57 DartCompiler.compileLib(lib, config, provider, listener); | 57 DartCompiler.compileLib(lib, config, provider, listener); |
| 58 | 58 listener.checkAllErrorsReported(); |
| 59 return provider.getArtifactString(src, part, JavascriptBackend.EXTENSION_JS)
; | 59 return provider.getArtifactString(src, part, JavascriptBackend.EXTENSION_JS)
; |
| 60 } | 60 } |
| 61 | 61 |
| 62 protected List<String> findMarkerLines(String js) { | 62 protected List<String> findMarkerLines(String js) { |
| 63 assertNotNull(js); | 63 assertNotNull(js); |
| 64 List<String> lines = new ArrayList<String>(); | 64 List<String> lines = new ArrayList<String>(); |
| 65 | 65 |
| 66 int begin = 0; | 66 int begin = 0; |
| 67 int end = 0; | 67 int end = 0; |
| 68 while (true) { | 68 while (true) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 assert end >= start; | 151 assert end >= start; |
| 152 List<String> result = new ArrayList<String>(); | 152 List<String> result = new ArrayList<String>(); |
| 153 for (String s : corpus.substring(start, end).split("\\n")) { | 153 for (String s : corpus.substring(start, end).split("\\n")) { |
| 154 if (s.equals("{") || s.equals("}")) | 154 if (s.equals("{") || s.equals("}")) |
| 155 continue; | 155 continue; |
| 156 result.add(s.trim()); | 156 result.add(s.trim()); |
| 157 } | 157 } |
| 158 return result.toArray(new String[0]); | 158 return result.toArray(new String[0]); |
| 159 } | 159 } |
| 160 } | 160 } |
| OLD | NEW |