diff --git a/ets2panda/compiler/lowering/ets/topLevelStmts/topLevelStmts.cpp b/ets2panda/compiler/lowering/ets/topLevelStmts/topLevelStmts.cpp index 28c205ee509256dbc3b010038bd740d490f63768..bd503f088e6b79ff499f78b405ce754d66e5e3bd 100644 --- a/ets2panda/compiler/lowering/ets/topLevelStmts/topLevelStmts.cpp +++ b/ets2panda/compiler/lowering/ets/topLevelStmts/topLevelStmts.cpp @@ -48,8 +48,29 @@ static bool CheckProgramSourcesConsistency(parser::Program *program) return success; } +static void CheckFileHeaderFlag(parser::Program *program) +{ + auto &statements = program->Ast()->Statements(); + if (statements.empty()) { + return; + } + + if (!statements.front()->IsExpressionStatement()) { + return; + } + + // If further processing based on "use static" is required later, such as throwing a warning or modifying the node, + // perform the operation here. + auto *expansion = statements.front()->AsExpressionStatement()->GetExpression(); + if (expansion->IsStringLiteral() && expansion->AsStringLiteral()->Str() == Signatures::STATIC_PROGRAM_FLAG) { + statements.erase(statements.begin()); + return; + } +} + bool TopLevelStatements::Perform(public_lib::Context *ctx, parser::Program *program) { + CheckFileHeaderFlag(program); auto imports = ImportExportDecls(program->VarBinder()->AsETSBinder(), ctx->parser->AsETSParser()); imports.ParseDefaultSources(); if (!CheckProgramSourcesConsistency(program)) { diff --git a/ets2panda/compiler/scripts/signatures.yaml b/ets2panda/compiler/scripts/signatures.yaml index 930c5a04087b92f5c227e959c23a33833e01b7e6..3a4186c8b77d04f615024e8396f1058a7f482da9 100644 --- a/ets2panda/compiler/scripts/signatures.yaml +++ b/ets2panda/compiler/scripts/signatures.yaml @@ -226,6 +226,8 @@ defines: ref: UNUSED_ETSGLOBAL_INIT - name: 'ETSGLOBAL.main:void;' ref: UNUSED_ETSGLOBAL_MAIN + - name: 'use static' + ref: STATIC_PROGRAM_FLAG packages: - name: 'std.core' diff --git a/ets2panda/parser/ETSparser.cpp b/ets2panda/parser/ETSparser.cpp index 6f423f8142839fc975af0135a8165a1efa2d9436..f42151a1205f0b5121b74a4559cbdb681423fefd 100644 --- a/ets2panda/parser/ETSparser.cpp +++ b/ets2panda/parser/ETSparser.cpp @@ -121,6 +121,7 @@ void ETSParser::ParseProgram(ScriptKind kind) } ArenaVector statements(Allocator()->Adapter()); + ParseFileHeaderFlag(startLoc, &statements); auto decl = ParsePackageDeclaration(); if (decl != nullptr) { statements.emplace_back(decl); @@ -147,6 +148,23 @@ void ETSParser::ParseProgram(ScriptKind kind) GetProgram()->SetAst(script); } +void ETSParser::ParseFileHeaderFlag(lexer::SourcePosition startLoc, ArenaVector *statements) +{ + if (Lexer()->GetToken().KeywordType() != lexer::TokenType::LITERAL_STRING || + Lexer()->GetToken().String() != compiler::Signatures::STATIC_PROGRAM_FLAG) { + return; + } + + ir::Expression *fileHeaderFlag = ParseStringLiteral(); + auto *exprStatementNode = AllocNode(fileHeaderFlag); + + exprStatementNode->SetRange({startLoc, fileHeaderFlag->End()}); + ConsumeSemicolon(exprStatementNode); + if (statements != nullptr) { + statements->push_back(exprStatementNode); + } +} + ir::ETSModule *ETSParser::ParseETSGlobalScript(lexer::SourcePosition startLoc, ArenaVector &statements) { ETSNolintParser etsnolintParser(this); @@ -408,6 +426,7 @@ parser::Program *ETSParser::ParseSource(const SourceFile &sourceFile) Lexer()->NextToken(); ArenaVector statements(Allocator()->Adapter()); + ParseFileHeaderFlag(startLoc, nullptr); auto decl = ParsePackageDeclaration(); ir::ETSModule *script = nullptr; if (decl != nullptr) { diff --git a/ets2panda/parser/ETSparser.h b/ets2panda/parser/ETSparser.h index 6a2e71876581b8db3371ef293a6c1822b6f70f42..37b3d195b34dc1aafde24a93536b5f3f7636c8c9 100644 --- a/ets2panda/parser/ETSparser.h +++ b/ets2panda/parser/ETSparser.h @@ -210,6 +210,7 @@ private: ArenaVector &directImportsFromMainSource); parser::Program *ParseSource(const SourceFile &sourceFile); ir::ETSModule *ParseETSGlobalScript(lexer::SourcePosition startLoc, ArenaVector &statements); + void ParseFileHeaderFlag(lexer::SourcePosition startLoc, ArenaVector *statements); ir::ETSModule *ParseImportsOnly(lexer::SourcePosition startLoc, ArenaVector &statements); ir::AstNode *ParseImportDefaultSpecifier(ArenaVector *specifiers) override; void *ApplyAnnotationsToClassElement(ir::AstNode *property, ArenaVector &&annotations, diff --git a/ets2panda/test/ast/compiler/ets/use_static_flag/export1.ets b/ets2panda/test/ast/compiler/ets/use_static_flag/export1.ets new file mode 100644 index 0000000000000000000000000000000000000000..3b6361ce1a4789171931375970fec7e30eca2183 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/use_static_flag/export1.ets @@ -0,0 +1,17 @@ +"use static" +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export class A{} diff --git a/ets2panda/test/ast/compiler/ets/use_static_flag/export2.ets b/ets2panda/test/ast/compiler/ets/use_static_flag/export2.ets new file mode 100644 index 0000000000000000000000000000000000000000..dd2d2b0a2bb7edc167a63a31f8c942f328adc945 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/use_static_flag/export2.ets @@ -0,0 +1,17 @@ +"use static" +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export class B{} diff --git a/ets2panda/test/ast/compiler/ets/use_static_flag/flag_after_copyright.ets b/ets2panda/test/ast/compiler/ets/use_static_flag/flag_after_copyright.ets new file mode 100644 index 0000000000000000000000000000000000000000..f5862745c147147f51b9ec5b5714f065230eda3a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/use_static_flag/flag_after_copyright.ets @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +"use static" + +class A{} diff --git a/ets2panda/test/ast/compiler/ets/use_static_flag/flag_after_importdecl.ets b/ets2panda/test/ast/compiler/ets/use_static_flag/flag_after_importdecl.ets new file mode 100644 index 0000000000000000000000000000000000000000..7245e8367d5aac3c021703a513bf65f2dd5e008a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/use_static_flag/flag_after_importdecl.ets @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { A as A } from "./export1.ets" +import { B as B } from "./export2.ets" + +"use static" +let str:String = "use static" diff --git a/ets2panda/test/ast/compiler/ets/use_static_flag/flag_before_importdecl.ets b/ets2panda/test/ast/compiler/ets/use_static_flag/flag_before_importdecl.ets new file mode 100644 index 0000000000000000000000000000000000000000..730bab7c5d8dcef84f875cf13ec9b48d068168c1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/use_static_flag/flag_before_importdecl.ets @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +"use static" +import {A as A} from "./export1.ets" +import {B as B} from "./export2.ets" diff --git a/ets2panda/test/ast/compiler/ets/use_static_flag/flag_in_first_line.ets b/ets2panda/test/ast/compiler/ets/use_static_flag/flag_in_first_line.ets new file mode 100644 index 0000000000000000000000000000000000000000..34045c2ff1fba6cbc4f2b9e554a52993a8dc8092 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/use_static_flag/flag_in_first_line.ets @@ -0,0 +1,17 @@ +"use static" +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +class A{} diff --git a/ets2panda/test/ast/compiler/ets/use_static_flag/flag_in_first_line_2.ets b/ets2panda/test/ast/compiler/ets/use_static_flag/flag_in_first_line_2.ets new file mode 100644 index 0000000000000000000000000000000000000000..c14b258b49588ae4c02145599c8dfabaa7bde4ea --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/use_static_flag/flag_in_first_line_2.ets @@ -0,0 +1,17 @@ +'use static' +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +class A{} diff --git a/ets2panda/test/ast/compiler/ets/use_static_flag/flag_in_first_line_2_neg.ets b/ets2panda/test/ast/compiler/ets/use_static_flag/flag_in_first_line_2_neg.ets new file mode 100644 index 0000000000000000000000000000000000000000..df09abb5e1ee956798bed2bc2115dfee085086c2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/use_static_flag/flag_in_first_line_2_neg.ets @@ -0,0 +1,19 @@ +'use statics' +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { A as A } from "./export1.ets" + +/* @@? 17:1 Error SyntaxError: Import declarations can only be used on the top level and before any other declaration, top level statement or directive. */ diff --git a/ets2panda/test/ast/compiler/ets/use_static_flag/flag_in_first_line_3_neg.ets b/ets2panda/test/ast/compiler/ets/use_static_flag/flag_in_first_line_3_neg.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b1cd257acd0d0cbf73be91edb3d5b127469f7ec --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/use_static_flag/flag_in_first_line_3_neg.ets @@ -0,0 +1,19 @@ +"uses static" +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { A as A } from "./export1.ets" + +/* @@? 17:1 Error SyntaxError: Import declarations can only be used on the top level and before any other declaration, top level statement or directive. */ diff --git a/ets2panda/test/ast/compiler/ets/use_static_flag/flag_in_first_line_neg.ets b/ets2panda/test/ast/compiler/ets/use_static_flag/flag_in_first_line_neg.ets new file mode 100644 index 0000000000000000000000000000000000000000..e0a410adc716e144cc402fdb62ae96b724f39a06 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/use_static_flag/flag_in_first_line_neg.ets @@ -0,0 +1,19 @@ +'uses static' +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { A as A } from "./export1.ets" + +/* @@? 17:1 Error SyntaxError: Import declarations can only be used on the top level and before any other declaration, top level statement or directive. */ diff --git a/ets2panda/test/ast/compiler/ets/use_static_flag/flag_middle_importdecl_neg.ets b/ets2panda/test/ast/compiler/ets/use_static_flag/flag_middle_importdecl_neg.ets new file mode 100644 index 0000000000000000000000000000000000000000..b048662c5703cee2ba8b580714f257041e2bc5f8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/use_static_flag/flag_middle_importdecl_neg.ets @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {A as A} from "./export1.ets" +"use static" +import {B as B} from "./export2.ets" + +/* @@? 18:1 Error SyntaxError: Import declarations can only be used on the top level and before any other declaration, top level statement or directive. */ diff --git a/ets2panda/test/ast/compiler/ets/use_static_flag/package/flag_before_package.ets b/ets2panda/test/ast/compiler/ets/use_static_flag/package/flag_before_package.ets new file mode 100644 index 0000000000000000000000000000000000000000..07508594ee080e6a93496f8f2806936dc7881ee8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/use_static_flag/package/flag_before_package.ets @@ -0,0 +1,17 @@ +"use static" +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package usestaticpackage; diff --git a/ets2panda/test/ast/compiler/ets/use_static_flag/package/flag_before_package2.ets b/ets2panda/test/ast/compiler/ets/use_static_flag/package/flag_before_package2.ets new file mode 100644 index 0000000000000000000000000000000000000000..07508594ee080e6a93496f8f2806936dc7881ee8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/use_static_flag/package/flag_before_package2.ets @@ -0,0 +1,17 @@ +"use static" +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package usestaticpackage; diff --git a/ets2panda/test/ast/compiler/ets/use_static_flag/package_2_neg/flag_before_package.ets b/ets2panda/test/ast/compiler/ets/use_static_flag/package_2_neg/flag_before_package.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee44269d82572ab85a05a0214ff273283d4a6b39 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/use_static_flag/package_2_neg/flag_before_package.ets @@ -0,0 +1,24 @@ +"use static" +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package usestaticpackage3; + +let str2:String = "use static" +import {A as A} from "../export1.ets" +import {B as B} from "../export2.ets" + +/* @@? 20:1 Error SyntaxError: Import declarations can only be used on the top level and before any other declaration, top level statement or directive. */ +/* @@? 21:1 Error SyntaxError: Import declarations can only be used on the top level and before any other declaration, top level statement or directive. */ diff --git a/ets2panda/test/ast/compiler/ets/use_static_flag/package_3_neg/flag_before_package.ets b/ets2panda/test/ast/compiler/ets/use_static_flag/package_3_neg/flag_before_package.ets new file mode 100644 index 0000000000000000000000000000000000000000..55490f06d0b94f607cc3ecab80a8e8b9cc0eddd2 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/use_static_flag/package_3_neg/flag_before_package.ets @@ -0,0 +1,25 @@ +"use static" +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package usestaticpackage3; + +"use static" +import {A as A} from "../export1.ets" +import {B as B} from "../export2.ets" + +/* @@? 19:1 Error SyntaxError: Invalid package toplevel statement */ +/* @@? 20:1 Error SyntaxError: Import declarations can only be used on the top level and before any other declaration, top level statement or directive. */ +/* @@? 21:1 Error SyntaxError: Import declarations can only be used on the top level and before any other declaration, top level statement or directive. */ diff --git a/ets2panda/test/ast/compiler/ets/use_static_flag/package_neg/flag_package.ets b/ets2panda/test/ast/compiler/ets/use_static_flag/package_neg/flag_package.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae374bb21fb24b2b877438455e694bd9f3e729cd --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/use_static_flag/package_neg/flag_package.ets @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package usestaticpackage2; + +"use static" + +/* @@? 18:1 Error SyntaxError: Invalid package toplevel statement */ diff --git a/ets2panda/test/ast/compiler/ets/use_static_flag/package_neg/flag_package2.ets b/ets2panda/test/ast/compiler/ets/use_static_flag/package_neg/flag_package2.ets new file mode 100644 index 0000000000000000000000000000000000000000..551145bbe750acc82006c7d76ef820ae82d68dcd --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/use_static_flag/package_neg/flag_package2.ets @@ -0,0 +1,19 @@ +"use static" +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package usestaticpackage2; + +/* @@? flag_package.ets:18:1 Error SyntaxError: Invalid package toplevel statement */ diff --git a/ets2panda/test/test-lists/srcdumper/srcdumper-ets-ignored.txt b/ets2panda/test/test-lists/srcdumper/srcdumper-ets-ignored.txt index 93f5508e79ab33a9cefb68d4ea2a09de3440521c..0f60c8fe116827cbe921c277e5a0f777100c85b6 100644 --- a/ets2panda/test/test-lists/srcdumper/srcdumper-ets-ignored.txt +++ b/ets2panda/test/test-lists/srcdumper/srcdumper-ets-ignored.txt @@ -178,6 +178,8 @@ ast/compiler/ets/namespace_tests/namespace.ets ast/compiler/ets/namespace_tests/namespace_ambient_export01.ets ast/compiler/ets/namespace_tests/namespace_ambient_export02.ets ast/compiler/ets/namespace_tests/namespace_ambient_export03.ets +ast/compiler/ets/use_static_flag/flag_after_importdecl.ets +ast/compiler/ets/use_static_flag/flag_before_importdecl.ets runtime/ets/namespace_tests/namespace_import_type_test/namespace_import.ets runtime/ets/namespace_tests/namespace_initializer.ets runtime/ets/interface_with_optional_property_cycle_import/class_file.ets