| 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.base.Objects; | 7 import com.google.common.base.Objects; |
| 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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 includedSourceUris.add(uri); | 600 includedSourceUris.add(uri); |
| 601 } | 601 } |
| 602 } | 602 } |
| 603 } | 603 } |
| 604 | 604 |
| 605 // Validate imports. | 605 // Validate imports. |
| 606 boolean hasIO = false; | 606 boolean hasIO = false; |
| 607 boolean hasHTML = false; | 607 boolean hasHTML = false; |
| 608 for (LibraryNode importNode : lib.getImportPaths()) { | 608 for (LibraryNode importNode : lib.getImportPaths()) { |
| 609 String libSpec = importNode.getText(); | 609 String libSpec = importNode.getText(); |
| 610 String prefix = importNode.getPrefix(); | |
| 611 hasIO |= "dart:io".equals(libSpec); | 610 hasIO |= "dart:io".equals(libSpec); |
| 612 hasHTML |= "dart:html".equals(libSpec); | 611 hasHTML |= "dart:html".equals(libSpec); |
| 613 // "dart:mirrors" are not done yet | 612 // "dart:mirrors" are not done yet |
| 614 if ("dart:mirrors".equals(libSpec)) { | 613 if ("dart:mirrors".equals(libSpec)) { |
| 615 context.onError(new DartCompilationError(importNode, | 614 context.onError(new DartCompilationError(importNode, |
| 616 DartCompilerErrorCode.MIRRORS_NOT_FULLY_IMPLEMENTED)); | 615 DartCompilerErrorCode.MIRRORS_NOT_FULLY_IMPLEMENTED)); |
| 617 } | 616 } |
| 618 // validate import prefix | |
| 619 if (DartParser.PSEUDO_KEYWORDS_SET.contains(prefix)) { | |
| 620 context.onError(new DartCompilationError(importNode.getSourceInfo(), | |
| 621 ResolverErrorCode.BUILT_IN_IDENTIFIER_AS_IMPORT_PREFIX, prefix))
; | |
| 622 } | |
| 623 // validate console/web mix | 617 // validate console/web mix |
| 624 if (hasIO && hasHTML) { | 618 if (hasIO && hasHTML) { |
| 625 context.onError(new DartCompilationError(importNode.getSourceInfo(), | 619 context.onError(new DartCompilationError(importNode.getSourceInfo(), |
| 626 DartCompilerErrorCode.CONSOLE_WEB_MIX)); | 620 DartCompilerErrorCode.CONSOLE_WEB_MIX)); |
| 627 } | 621 } |
| 628 } | 622 } |
| 629 | 623 |
| 630 // check that each exported library has a library directive | 624 // check that each exported library has a library directive |
| 631 for (LibraryExport libraryExport : lib.getExports()) { | 625 for (LibraryExport libraryExport : lib.getExports()) { |
| 632 LibraryUnit exportedLibrary = libraryExport.getLibrary(); | 626 LibraryUnit exportedLibrary = libraryExport.getLibrary(); |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1410 return br.readLine(); | 1404 return br.readLine(); |
| 1411 } finally { | 1405 } finally { |
| 1412 br.close(); | 1406 br.close(); |
| 1413 } | 1407 } |
| 1414 } | 1408 } |
| 1415 } catch (Throwable e) { | 1409 } catch (Throwable e) { |
| 1416 } | 1410 } |
| 1417 return null; | 1411 return null; |
| 1418 } | 1412 } |
| 1419 } | 1413 } |
| OLD | NEW |