-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow unsupported syntax (#171)
* Add syntax-forgiving debug parameter to allow/disallow unsupported syntax * Add silence-test-output debug parameter to enable/disable test output to console * Move constant pool code from launcher to root context * Add common abstract factory for all analysis factories
- Loading branch information
1 parent
3552746
commit b837ebc
Showing
55 changed files
with
609 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright 2020-2023 Delft University of Technology and SynTest contributors | ||
* | ||
* This file is part of SynTest Framework - SynTest JavaScript. | ||
* | ||
* 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 Factory { | ||
private _syntaxForgiving: boolean; | ||
|
||
constructor(syntaxForgiving: boolean) { | ||
this._syntaxForgiving = syntaxForgiving; | ||
} | ||
|
||
get syntaxForgiving() { | ||
return this._syntaxForgiving; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
libraries/analysis-javascript/lib/constant/ConstantPoolFactory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright 2020-2023 Delft University of Technology and SynTest contributors | ||
* | ||
* This file is part of SynTest Framework - SynTest JavaScript. | ||
* | ||
* 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 { traverse } from "@babel/core"; | ||
import * as t from "@babel/types"; | ||
|
||
import { Factory } from "../Factory"; | ||
import { ConstantVisitor } from "./ConstantVisitor"; | ||
import { ConstantPool } from "./ConstantPool"; | ||
|
||
export class ConstantPoolFactory extends Factory { | ||
/** | ||
* Generate function map for specified target. | ||
* | ||
* @param AST The AST of the target | ||
*/ | ||
extract( | ||
filePath: string, | ||
AST: t.Node, | ||
constantPool?: ConstantPool | undefined | ||
): ConstantPool { | ||
if (!constantPool) { | ||
constantPool = new ConstantPool(); | ||
} | ||
const constantVisitor = new ConstantVisitor( | ||
filePath, | ||
this.syntaxForgiving, | ||
constantPool | ||
); | ||
traverse(AST, constantVisitor); | ||
|
||
return constantPool; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.