mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-07-06 01:52:04 +00:00
Try parsing signatures only if node is callable, see #149; Minor refactoring
This commit is contained in:
@ -36,6 +36,16 @@ import {
|
||||
getGetLocalIndex
|
||||
} from "./module";
|
||||
|
||||
import {
|
||||
CommonFlags,
|
||||
PATH_DELIMITER,
|
||||
INNER_DELIMITER,
|
||||
INSTANCE_DELIMITER,
|
||||
STATIC_DELIMITER,
|
||||
GETTER_PREFIX,
|
||||
SETTER_PREFIX
|
||||
} from "./common";
|
||||
|
||||
import {
|
||||
Program,
|
||||
ClassPrototype,
|
||||
@ -54,18 +64,10 @@ import {
|
||||
Property,
|
||||
VariableLikeElement,
|
||||
FlowFlags,
|
||||
CommonFlags,
|
||||
ConstantValueKind,
|
||||
Flow,
|
||||
OperatorKind,
|
||||
DecoratorFlags,
|
||||
|
||||
PATH_DELIMITER,
|
||||
INNER_DELIMITER,
|
||||
INSTANCE_DELIMITER,
|
||||
STATIC_DELIMITER,
|
||||
GETTER_PREFIX,
|
||||
SETTER_PREFIX
|
||||
DecoratorFlags
|
||||
} from "./program";
|
||||
|
||||
import {
|
||||
@ -1487,17 +1489,11 @@ export class Compiler extends DiagnosticEmitter {
|
||||
this.currentFunction.flow = blockFlow;
|
||||
|
||||
var stmts = this.compileStatements(statements);
|
||||
var lastType: NativeType;
|
||||
var stmt = stmts.length == 0
|
||||
? this.module.createNop()
|
||||
: stmts.length == 1
|
||||
? stmts[0]
|
||||
: this.module.createBlock(null, stmts,
|
||||
// if the last expression is a value, annotate the block's return value
|
||||
(lastType = getExpressionType(stmts[stmts.length - 1])) == NativeType.None
|
||||
? NativeType.None
|
||||
: lastType
|
||||
);
|
||||
: this.module.createBlock(null, stmts,getExpressionType(stmts[stmts.length - 1]));
|
||||
|
||||
// Switch back to the parent flow
|
||||
var parentFlow = blockFlow.leaveBranchOrScope();
|
||||
|
Reference in New Issue
Block a user